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) && !empty($matches[1])) { 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/XUvUD
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 = 46) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/XUvUD
function name:  getaname
number of ops:  18
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%2A%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_EX                                          ~7      $6, ->12
          9    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~8      !3, 1
         10        BOOL_NOT                                         ~9      ~8
         11        BOOL                                             ~7      ~9
         12    > > JMPZ                                                     ~7, ->16
   10    13    >   FETCH_DIM_R                                      ~10     !3, 1
         14      > RETURN                                                   ~10
    9    15*       JMP                                                      ->17
   12    16    > > RETURN                                                   'N%2FA'
   14    17*     > RETURN                                                   null

End of function getaname

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.83 ms | 1005 KiB | 15 Q