3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $mything; public function __construct($mything) { $this->mything = $mything; } public function doStuff($a) { return $a; } public static function doStaticStuff($a) { return $a; } } $foo = new Foo(range('A', 'Z')); var_dump(serialize(array($foo, 'doStuff'))); var_dump(serialize(array('Foo', 'doStaticStuff'))); $method = 'doStuff'; echo $foo->$method('bar');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Tliv
function name:  (null)
number of ops:  28
compiled vars:  !0 = $foo, !1 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $2      'Foo'
          1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 'A'
          3        SEND_VAL                                                 'Z'
          4        DO_ICALL                                         $3      
          5        SEND_VAR_NO_REF_EX                                       $3
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $2
   15     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'serialize'
         10        INIT_ARRAY                                       ~6      !0
         11        ADD_ARRAY_ELEMENT                                ~6      'doStuff'
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
   16    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'serialize'
         18        SEND_VAL                                                 <array>
         19        DO_ICALL                                         $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                                 
   17    22        ASSIGN                                                   !1, 'doStuff'
   18    23        INIT_METHOD_CALL                                         !0, !1
         24        SEND_VAL_EX                                              'bar'
         25        DO_FCALL                                      0  $12     
         26        ECHO                                                     $12
         27      > RETURN                                                   1

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

End of function __construct

Function dostuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Tliv
function name:  doStuff
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1      > RETURN                                                   !0
    9     2*     > RETURN                                                   null

End of function dostuff

Function dostaticstuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Tliv
function name:  doStaticStuff
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1      > RETURN                                                   !0
   12     2*     > RETURN                                                   null

End of function dostaticstuff

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.66 ms | 1400 KiB | 19 Q