3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { const MYARRAY = ['foo' => 'bar']; protected static $props = ['Hello' => 'Foo Value']; function getPropValue($propName) { return static::$props[$propName]; } function myFunc() { return 'hey myFunc'; } function yourFunc() { return 'hey yourFunc'; } function checkConst() { if (isset(static::MYARRAY['foo'])) { echo 'foo is set' . "\n\n"; } else { echo 'foo is not set' . "\n\n"; } } } class Bar extends Foo { protected static $props = ['Hello' => 'Bar Value']; } $foo = new Foo(); echo $foo->getPropValue('Hello') . "\n\n"; // $functionArray = ['myFunc' => 'myFunc']; // echo $foo->$functionArray['myFunc']() . "\n\n"; $bar = new Bar(); echo $bar->getPropValue('Hello') . "\n\n"; $foo->checkConst();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  (null)
number of ops:  19
compiled vars:  !0 = $foo, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   35     3        INIT_METHOD_CALL                                         !0, 'getPropValue'
          4        SEND_VAL_EX                                              'Hello'
          5        DO_FCALL                                      0  $5      
          6        CONCAT                                           ~6      $5, '%0A%0A'
          7        ECHO                                                     ~6
   40     8        NEW                                              $7      'Bar'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $7
   41    11        INIT_METHOD_CALL                                         !1, 'getPropValue'
         12        SEND_VAL_EX                                              'Hello'
         13        DO_FCALL                                      0  $10     
         14        CONCAT                                           ~11     $10, '%0A%0A'
         15        ECHO                                                     ~11
   43    16        INIT_METHOD_CALL                                         !0, 'checkConst'
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Class Foo:
Function getpropvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  getPropValue
number of ops:  5
compiled vars:  !0 = $propName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_STATIC_PROP_R          unknown             ~1      'props'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
   10     4*     > RETURN                                                   null

End of function getpropvalue

Function myfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  myFunc
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   'hey+myFunc'
   14     1*     > RETURN                                                   null

End of function myfunc

Function yourfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  yourFunc
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > RETURN                                                   'hey+yourFunc'
   18     1*     > RETURN                                                   null

End of function yourfunc

Function checkconst:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  checkConst
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_CLASS_CONSTANT                             ~0      'MYARRAY'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~0, 'foo'
          2      > JMPZ                                                     ~1, ->5
   22     3    >   ECHO                                                     'foo+is+set%0A%0A'
          4      > JMP                                                      ->6
   24     5    >   ECHO                                                     'foo+is+not+set%0A%0A'
   26     6    > > RETURN                                                   null

End of function checkconst

End of class Foo.

Class Bar:
Function getpropvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  getPropValue
number of ops:  5
compiled vars:  !0 = $propName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_STATIC_PROP_R          unknown             ~1      'props'
          2        FETCH_DIM_R                                      ~2      ~1, !0
          3      > RETURN                                                   ~2
   10     4*     > RETURN                                                   null

End of function getpropvalue

Function myfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  myFunc
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   'hey+myFunc'
   14     1*     > RETURN                                                   null

End of function myfunc

Function yourfunc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  yourFunc
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > RETURN                                                   'hey+yourFunc'
   18     1*     > RETURN                                                   null

End of function yourfunc

Function checkconst:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ureLv
function name:  checkConst
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_CLASS_CONSTANT                             ~0      'MYARRAY'
          1        ISSET_ISEMPTY_DIM_OBJ                         0          ~0, 'foo'
          2      > JMPZ                                                     ~1, ->5
   22     3    >   ECHO                                                     'foo+is+set%0A%0A'
          4      > JMP                                                      ->6
   24     5    >   ECHO                                                     'foo+is+not+set%0A%0A'
   26     6    > > RETURN                                                   null

End of function checkconst

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.5 ms | 1403 KiB | 13 Q