3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo mb_substr('123abcdef', 3); echo "\n"; function endingCodeTag($content, $n) { $contentRest = mb_substr($content, $n); preg_match('/^\<code\s+lang(?:[\s]*>|\W[^\>]*\>)/u', $contentRest, $resultArr); if(!empty($resultArr[0])) return $resultArr[0]; else return ''; } var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 20)); var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 18)); var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 19)); var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 21)); var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 22)); var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 23)); var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 24));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mEZF1
function name:  (null)
number of ops:  56
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'mb_substr'
          1        SEND_VAL                                                 '123abcdef'
          2        SEND_VAL                                                 3
          3        DO_ICALL                                         $0      
          4        ECHO                                                     $0
    4     5        ECHO                                                     '%0A'
   16     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'endingcodetag'
          8        SEND_VAL                                                 '%3Cp%3E+f+g+f++rt+e%3C%2Fp%3E+%3Ccode+lang%3Edf+g+df+%3D+%5C%28fsgfsd'
          9        SEND_VAL                                                 20
         10        DO_FCALL                                      0  $1      
         11        SEND_VAR                                                 $1
         12        DO_ICALL                                                 
   17    13        INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'endingcodetag'
         15        SEND_VAL                                                 '%3Cp%3E+f+g+f++rt+e%3C%2Fp%3E+%3Ccode+lang%3Edf+g+df+%3D+%5C%28fsgfsd'
         16        SEND_VAL                                                 18
         17        DO_FCALL                                      0  $3      
         18        SEND_VAR                                                 $3
         19        DO_ICALL                                                 
   18    20        INIT_FCALL                                               'var_dump'
         21        INIT_FCALL                                               'endingcodetag'
         22        SEND_VAL                                                 '%3Cp%3E+f+g+f++rt+e%3C%2Fp%3E+%3Ccode+lang%3Edf+g+df+%3D+%5C%28fsgfsd'
         23        SEND_VAL                                                 19
         24        DO_FCALL                                      0  $5      
         25        SEND_VAR                                                 $5
         26        DO_ICALL                                                 
   19    27        INIT_FCALL                                               'var_dump'
         28        INIT_FCALL                                               'endingcodetag'
         29        SEND_VAL                                                 '%3Cp%3E+f+g+f++rt+e%3C%2Fp%3E+%3Ccode+lang%3Edf+g+df+%3D+%5C%28fsgfsd'
         30        SEND_VAL                                                 21
         31        DO_FCALL                                      0  $7      
         32        SEND_VAR                                                 $7
         33        DO_ICALL                                                 
   20    34        INIT_FCALL                                               'var_dump'
         35        INIT_FCALL                                               'endingcodetag'
         36        SEND_VAL                                                 '%3Cp%3E+f+g+f++rt+e%3C%2Fp%3E+%3Ccode+lang%3Edf+g+df+%3D+%5C%28fsgfsd'
         37        SEND_VAL                                                 22
         38        DO_FCALL                                      0  $9      
         39        SEND_VAR                                                 $9
         40        DO_ICALL                                                 
   21    41        INIT_FCALL                                               'var_dump'
         42        INIT_FCALL                                               'endingcodetag'
         43        SEND_VAL                                                 '%3Cp%3E+f+g+f++rt+e%3C%2Fp%3E+%3Ccode+lang%3Edf+g+df+%3D+%5C%28fsgfsd'
         44        SEND_VAL                                                 23
         45        DO_FCALL                                      0  $11     
         46        SEND_VAR                                                 $11
         47        DO_ICALL                                                 
   22    48        INIT_FCALL                                               'var_dump'
         49        INIT_FCALL                                               'endingcodetag'
         50        SEND_VAL                                                 '%3Cp%3E+f+g+f++rt+e%3C%2Fp%3E+%3Ccode+lang%3Edf+g+df+%3D+%5C%28fsgfsd'
         51        SEND_VAL                                                 24
         52        DO_FCALL                                      0  $13     
         53        SEND_VAR                                                 $13
         54        DO_ICALL                                                 
         55      > RETURN                                                   1

Function endingcodetag:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mEZF1
function name:  endingCodeTag
number of ops:  20
compiled vars:  !0 = $content, !1 = $n, !2 = $contentRest, !3 = $resultArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'mb_substr'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !2, $4
    9     7        INIT_FCALL                                               'preg_match'
          8        SEND_VAL                                                 '%2F%5E%5C%3Ccode%5Cs%2Blang%28%3F%3A%5B%5Cs%5D%2A%3E%7C%5CW%5B%5E%5C%3E%5D%2A%5C%3E%29%2Fu'
          9        SEND_VAR                                                 !2
         10        SEND_REF                                                 !3
         11        DO_ICALL                                                 
   10    12        ISSET_ISEMPTY_DIM_OBJ                         1  ~7      !3, 0
         13        BOOL_NOT                                         ~8      ~7
         14      > JMPZ                                                     ~8, ->18
   11    15    >   FETCH_DIM_R                                      ~9      !3, 0
         16      > RETURN                                                   ~9
         17*       JMP                                                      ->19
   13    18    > > RETURN                                                   ''
   14    19*     > RETURN                                                   null

End of function endingcodetag

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.26 ms | 1402 KiB | 26 Q