3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $foo = 1; private $bar = 2; public function toArray() { $publics_only = function() use ($i) { return get_object_vars($i); }; return $publics_only(); } } $foo = new Foo(); var_dump($foo->toArray());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HMlgT
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   16     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'toArray'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FHMlgT%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HMlgT
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   BIND_STATIC                                              !0
    9     1        INIT_FCALL                                               'get_object_vars'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   10     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FHMlgT%3A8%240

Class Foo:
Function toarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HMlgT
function name:  toArray
number of ops:  7
compiled vars:  !0 = $publics_only, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FHMlgT%3A8%240'
          1        BIND_LEXICAL                                             ~2, !1
          2        ASSIGN                                                   !0, ~2
   11     3        INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0  $4      
          5      > RETURN                                                   $4
   12     6*     > RETURN                                                   null

End of function toarray

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144 ms | 1396 KiB | 17 Q