3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array['articletext'][] = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.<hr id=\'system-readmore\' />"; $array['articletext'][] = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.'; $array['articletext'][] = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.<hr id=\"system-readmore\" />Some more text after the readmore tag'; $pattern = '~(.*?)<hr\s+id=\\\[\'"]system-readmore\\\[\'"]\s+/>(.*)~is'; // run test cases foreach ($array['articletext'] as $article) { if (preg_match($pattern, $article, $matches)) { echo "MATCH\n"; echo "\$introtext = $matches[1]\n"; echo "\$fulltext = $matches[2]\n---\n"; } else { echo "NO MATCH\n"; echo "\$introtext = $article\n"; echo "\$fulltext = [null]\n---\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 38
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 38
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 31
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
filename:       /in/Ndi2P
function name:  (null)
number of ops:  40
compiled vars:  !0 = $array, !1 = $pattern, !2 = $article, !3 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   FETCH_DIM_W                                      $4      !0, 'articletext'
          1        ASSIGN_DIM                                               $4
          2        OP_DATA                                                  'Lorem+Ipsum+is+simply+dummy+text+of+the+printing+and+typesetting+industry.%3Chr+id%3D%5C%27system-readmore%5C%27+%2F%3E'
    3     3        FETCH_DIM_W                                      $6      !0, 'articletext'
          4        ASSIGN_DIM                                               $6
          5        OP_DATA                                                  'Lorem+Ipsum+is+simply+dummy+text+of+the+printing+and+typesetting+industry.'
    4     6        FETCH_DIM_W                                      $8      !0, 'articletext'
          7        ASSIGN_DIM                                               $8
          8        OP_DATA                                                  'Lorem+Ipsum+is+simply+dummy+text+of+the+printing+and+typesetting+industry.%3Chr+id%3D%5C%22system-readmore%5C%22+%2F%3ESome+more+text+after+the+readmore+tag'
    6     9        ASSIGN                                                   !1, '%7E%28.%2A%3F%29%3Chr%5Cs%2Bid%3D%5C%5C%5B%27%22%5Dsystem-readmore%5C%5C%5B%27%22%5D%5Cs%2B%2F%3E%28.%2A%29%7Eis'
    9    10        FETCH_DIM_R                                      ~11     !0, 'articletext'
         11      > FE_RESET_R                                       $12     ~11, ->38
         12    > > FE_FETCH_R                                               $12, !2, ->38
   10    13    >   INIT_FCALL                                               'preg_match'
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !2
         16        SEND_REF                                                 !3
         17        DO_ICALL                                         $13     
         18      > JMPZ                                                     $13, ->31
   11    19    >   ECHO                                                     'MATCH%0A'
   12    20        ROPE_INIT                                     3  ~16     '%24introtext+%3D+'
         21        FETCH_DIM_R                                      ~14     !3, 1
         22        ROPE_ADD                                      1  ~16     ~16, ~14
         23        ROPE_END                                      2  ~15     ~16, '%0A'
         24        ECHO                                                     ~15
   13    25        ROPE_INIT                                     3  ~20     '%24fulltext+%3D+'
         26        FETCH_DIM_R                                      ~18     !3, 2
         27        ROPE_ADD                                      1  ~20     ~20, ~18
         28        ROPE_END                                      2  ~19     ~20, '%0A---%0A'
         29        ECHO                                                     ~19
         30      > JMP                                                      ->37
   15    31    >   ECHO                                                     'NO+MATCH%0A'
   16    32        ROPE_INIT                                     3  ~23     '%24introtext+%3D+'
         33        ROPE_ADD                                      1  ~23     ~23, !2
         34        ROPE_END                                      2  ~22     ~23, '%0A'
         35        ECHO                                                     ~22
   17    36        ECHO                                                     '%24fulltext+%3D+%5Bnull%5D%0A---%0A'
    9    37    > > JMP                                                      ->12
         38    >   FE_FREE                                                  $12
   19    39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.99 ms | 1400 KiB | 15 Q