3v4l.org

run code in 500+ 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) { var_dump($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/J0Lkk
function name:  (null)
number of ops:  15
compiled vars:  !0 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   43     0  E >   NEW                                                  $1      'Foo'
          1        SEND_VAL_EX                                                  <array>
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   44     4        INIT_FCALL                                                   'var_dump'
          5        INIT_METHOD_CALL                                             !0, 'bar'
          6        DO_FCALL                                          0  $4      
          7        SEND_VAR                                                     $4
          8        DO_ICALL                                                     
   45     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/J0Lkk
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/J0Lkk
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/J0Lkk
function name:  __isset
number of ops:  9
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
   22     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                                     
   23     4        FETCH_OBJ_IS                                         ~2      'items'
          5        FETCH_OBJ_IS                                         ~3      ~2, 'params'
          6        ISSET_ISEMPTY_DIM_OBJ                             0  ~4      ~3, !0
          7      > RETURN                                                       ~4
   24     8*     > 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/J0Lkk
function name:  bar
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   FETCH_OBJ_IS                                         ~0      'a'
          1        ISSET_ISEMPTY_DIM_OBJ                             0          ~0, 'xyz'
          2      > JMPZ                                                         ~1, ->4
   28     3    > > RETURN                                                       'yes'
   30     4    > > RETURN                                                       'no'
   31     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/J0Lkk
function name:  baz
number of ops:  7
compiled vars:  !0 = $tmp
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   34     0  E >   FETCH_OBJ_R                                          ~1      'a'
          1        ASSIGN                                                       !0, ~1
   36     2        ISSET_ISEMPTY_DIM_OBJ                             0          !0, 'xyz'
          3      > JMPZ                                                         ~3, ->5
   37     4    > > RETURN                                                       'yes'
   39     5    > > RETURN                                                       'no'
   40     6*     > RETURN                                                       null

End of function baz

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.6 ms | 2674 KiB | 14 Q