3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getaname($name) { $result = '<div></div>'; // Outputs NA //$result = '<div class="classname"></div>'; // Outputs NA //$result = '<div class="classname">42</div>'; // Outputs match - 42 $regex = '/<div class="classname">([^<]+)<\/div>/'; if (preg_match($regex, $result, $matches)) { return $matches[1]; } else { return 'N/A'; } } echo getaname('z');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eo1bF
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'getaname'
          1        SEND_VAL                                                 'z'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function getaname:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eo1bF
function name:  getaname
number of ops:  14
compiled vars:  !0 = $name, !1 = $result, !2 = $regex, !3 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, '%3Cdiv%3E%3C%2Fdiv%3E'
    8     2        ASSIGN                                                   !2, '%2F%3Cdiv+class%3D%22classname%22%3E%28%5B%5E%3C%5D%2B%29%3C%5C%2Fdiv%3E%2F'
    9     3        INIT_FCALL                                               'preg_match'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !1
          6        SEND_REF                                                 !3
          7        DO_ICALL                                         $6      
          8      > JMPZ                                                     $6, ->12
   10     9    >   FETCH_DIM_R                                      ~7      !3, 1
         10      > RETURN                                                   ~7
    9    11*       JMP                                                      ->13
   12    12    > > RETURN                                                   'N%2FA'
   14    13*     > RETURN                                                   null

End of function getaname

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.42 ms | 1004 KiB | 15 Q