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'; } } 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"; if (isset(Foo::MYARRAY['foo'])) { echo 'foo is set' . "\n\n"; } else { echo 'foo is not set' . "\n\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0UC54
function name:  (null)
number of ops:  29
compiled vars:  !0 = $foo, !1 = $functionArray, !2 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   27     3        INIT_METHOD_CALL                                         !0, 'getPropValue'
          4        SEND_VAL_EX                                              'Hello'
          5        DO_FCALL                                      0  $6      
          6        CONCAT                                           ~7      $6, '%0A%0A'
          7        ECHO                                                     ~7
   29     8        ASSIGN                                                   !1, <array>
   30     9        FETCH_OBJ_R                                      ~9      !0, !1
         10        FETCH_DIM_R                                      ~10     ~9, 'myFunc'
         11        INIT_DYNAMIC_CALL                                        ~10
         12        DO_FCALL                                      0  $11     
         13        CONCAT                                           ~12     $11, '%0A%0A'
         14        ECHO                                                     ~12
   32    15        NEW                                              $13     'Bar'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !2, $13
   33    18        INIT_METHOD_CALL                                         !2, 'getPropValue'
         19        SEND_VAL_EX                                              'Hello'
         20        DO_FCALL                                      0  $16     
         21        CONCAT                                           ~17     $16, '%0A%0A'
         22        ECHO                                                     ~17
   35    23        ISSET_ISEMPTY_DIM_OBJ                         0          <array>, 'foo'
         24      > JMPZ                                                     ~18, ->27
   36    25    >   ECHO                                                     'foo+is+set%0A%0A'
         26      > JMP                                                      ->28
   38    27    >   ECHO                                                     'foo+is+not+set%0A%0A'
   39    28    > > RETURN                                                   1

Class Foo:
Function getpropvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0UC54
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/0UC54
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/0UC54
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

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/0UC54
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/0UC54
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/0UC54
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

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.28 ms | 1399 KiB | 13 Q