3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $functionArray = ['myFunc' => 'yourFunc']; 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";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Naq7H
function name:  (null)
number of ops:  24
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
         23      > RETURN                                                   1

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