3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { return 'bar'; } } $services = []; function foo() { global $services; return $services['foo'] = new Foo(); } // $services['foo'] = new Foo(); echo (isset($services['foo']) ? $services['foo'] : foo())->bar();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rspdo
function name:  (null)
number of ops:  13
compiled vars:  !0 = $services
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   17     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 'foo'
          2      > JMPZ                                                     ~2, ->6
          3    >   FETCH_DIM_R                                      ~3      !0, 'foo'
          4        QM_ASSIGN                                        ~4      ~3
          5      > JMP                                                      ->9
          6    >   INIT_FCALL                                               'foo'
          7        DO_FCALL                                      0  $5      
          8        QM_ASSIGN                                        ~4      $5
          9    >   INIT_METHOD_CALL                                         ~4, 'bar'
         10        DO_FCALL                                      0  $6      
         11        ECHO                                                     $6
         12      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rspdo
function name:  foo
number of ops:  7
compiled vars:  !0 = $services
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   BIND_GLOBAL                                              !0, 'services'
          1        NEW                                              $2      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN_DIM                                       ~1      !0, 'foo'
          4        OP_DATA                                                  $2
          5      > RETURN                                                   ~1
          6*     > RETURN                                                   null

End of function foo

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rspdo
function name:  bar
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   'bar'
    7     1*     > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.53 ms | 1399 KiB | 14 Q