3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $items; function __construct($a) { $this->items = []; $this->items['params'] = []; $this->items['a'] = $a; } function __get($name) { if ($name === 'a') { return $this->items['a']; } return null; } function __isset($a) { return isset($this->items->params[$a]); } function bar() { if (isset($this->a['xyz'])) { return 'yes'; } return 'no'; } function baz() { $tmp = $this->a; if (isset($tmp['xyz'])) { return 'yes'; } return 'no'; } } $f = new Foo(['xyz' => true]); var_dump($f->bar()); var_dump($f->baz());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9QFk
function name:  (null)
number of ops:  15
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   NEW                                              $1      'Foo'
          1        SEND_VAL_EX                                              <array>
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   43     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'bar'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   44     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'baz'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9QFk
function name:  __construct
number of ops:  10
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'items'
          2        OP_DATA                                                  <array>
    9     3        FETCH_OBJ_W                                      $2      'items'
          4        ASSIGN_DIM                                               $2, 'params'
          5        OP_DATA                                                  <array>
   10     6        FETCH_OBJ_W                                      $4      'items'
          7        ASSIGN_DIM                                               $4, 'a'
          8        OP_DATA                                                  !0
   11     9      > RETURN                                                   null

End of function __construct

Function __get:
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 = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9QFk
function name:  __get
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        IS_IDENTICAL                                             !0, 'a'
          2      > JMPZ                                                     ~1, ->6
   15     3    >   FETCH_OBJ_R                                      ~2      'items'
          4        FETCH_DIM_R                                      ~3      ~2, 'a'
          5      > RETURN                                                   ~3
   18     6    > > RETURN                                                   null
   19     7*     > RETURN                                                   null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9QFk
function name:  __isset
number of ops:  6
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        FETCH_OBJ_IS                                     ~1      'items'
          2        FETCH_OBJ_IS                                     ~2      ~1, 'params'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      ~2, !0
          4      > RETURN                                                   ~3
   23     5*     > RETURN                                                   null

End of function __isset

Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9QFk
function name:  bar
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   FETCH_OBJ_IS                                     ~0      'a'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~0, 'xyz'
          2      > JMPZ                                                     ~1, ->4
   27     3    > > RETURN                                                   'yes'
   29     4    > > RETURN                                                   'no'
   30     5*     > RETURN                                                   null

End of function bar

Function baz:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9QFk
function name:  baz
number of ops:  7
compiled vars:  !0 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   FETCH_OBJ_R                                      ~1      'a'
          1        ASSIGN                                                   !0, ~1
   35     2        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 'xyz'
          3      > JMPZ                                                     ~3, ->5
   36     4    > > RETURN                                                   'yes'
   38     5    > > RETURN                                                   'no'
   39     6*     > RETURN                                                   null

End of function baz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.44 ms | 1400 KiB | 15 Q