3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function y() { $GLOBALS['y'] = null; return true; } public function z() { echo "Hello World\n"; } } function nullthrows($x) { if ($x === null) { throw new Exception('Unexpected null'); } return $x; } function foo($x) { if ($x && $x->y()) { nullthrows($x)->z(); } } $x = array(new A()); $y = &$x[0]; foo($y);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OEGDE
function name:  (null)
number of ops:  10
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        INIT_ARRAY                                       ~4      $2
          3        ASSIGN                                                   !0, ~4
   28     4        FETCH_DIM_W                                      $6      !0, 0
          5        ASSIGN_REF                                               !1, $6
   29     6        INIT_FCALL                                               'foo'
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0          
          9      > RETURN                                                   1

Function nullthrows:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OEGDE
function name:  nullthrows
number of ops:  9
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->7
   16     3    >   NEW                                              $2      'Exception'
          4        SEND_VAL_EX                                              'Unexpected+null'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
   18     7    > > RETURN                                                   !0
   19     8*     > RETURN                                                   null

End of function nullthrows

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
Branch analysis from position: 5
filename:       /in/OEGDE
function name:  foo
number of ops:  12
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1      > JMPZ_EX                                          ~1      !0, ->5
          2    >   INIT_METHOD_CALL                                         !0, 'y'
          3        DO_FCALL                                      0  $2      
          4        BOOL                                             ~1      $2
          5    > > JMPZ                                                     ~1, ->11
   23     6    >   INIT_FCALL                                               'nullthrows'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $3      
          9        INIT_METHOD_CALL                                         $3, 'z'
         10        DO_FCALL                                      0          
   25    11    > > RETURN                                                   null

End of function foo

Class A:
Function y:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OEGDE
function name:  y
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_W                      global              $0      'GLOBALS'
          1        ASSIGN_DIM                                               $0, 'y'
          2        OP_DATA                                                  null
    6     3      > RETURN                                                   <true>
    7     4*     > RETURN                                                   null

End of function y

Function z:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OEGDE
function name:  z
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'Hello+World%0A'
   11     1      > RETURN                                                   null

End of function z

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.48 ms | 1402 KiB | 15 Q