3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $foo = 1; private $bar = 2; public function toArray() { $i = $this; $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/r9RiR
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     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%2Fr9RiR%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r9RiR
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        INIT_FCALL                                               'get_object_vars'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   11     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fr9RiR%3A9%240

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

End of function toarray

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.46 ms | 1396 KiB | 17 Q