3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $_attributes = []; public function __get($name) { return null; // $this->_attributes[$name]; } } class Bar { public $relation; public $need; public function test() { $relation = $this->relation; if (!empty($relation->{$this->need})) { return 'Not empty'; } } } $foo = new Foo(); $bar = new Bar(); $bar->relation = $foo; $bar->need = 'slug'; var_dump($bar->test());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TXJ5f
function name:  (null)
number of ops:  16
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   25     3        NEW                                              $5      'Bar'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   26     6        ASSIGN_OBJ                                               !1, 'relation'
          7        OP_DATA                                                  !0
   27     8        ASSIGN_OBJ                                               !1, 'need'
          9        OP_DATA                                                  'slug'
   28    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !1, 'test'
         12        DO_FCALL                                      0  $10     
         13        SEND_VAR                                                 $10
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

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

End of function __get

End of class Foo.

Class Bar:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TXJ5f
function name:  test
number of ops:  8
compiled vars:  !0 = $relation
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~1      'relation'
          1        ASSIGN                                                   !0, ~1
   18     2        FETCH_OBJ_R                                      ~3      'need'
          3        ISSET_ISEMPTY_PROP_OBJ                           ~4      !0, ~3
          4        BOOL_NOT                                         ~5      ~4
          5      > JMPZ                                                     ~5, ->7
   19     6    > > RETURN                                                   'Not+empty'
   21     7    > > RETURN                                                   null

End of function test

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.24 ms | 1396 KiB | 15 Q