3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo{ private $bar = 'baz'; public function setBar($bar) { $this->bar = $bar; } } $foo = new Foo(); $hydrator = Closure::bind( function ($obj) { get_object_vars($obj); }, new Foo(), // required blueprint! 'Foo' // setting correct class scope (in case of inheritances) ); var_dump($hydrator($foo)); $foo2 = new Foo(); $foo2->setBar('TAB!'); var_dump($hydrator($foo2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SmsuL
function name:  (null)
number of ops:  31
compiled vars:  !0 = $foo, !1 = $hydrator, !2 = $foo2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $3      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   13     3        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
   14     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FSmsuL%3A14%240'
   16     5        SEND_VAL                                                 ~6
   17     6        NEW                                              $7      'Foo'
          7        DO_FCALL                                      0          
          8        SEND_VAR                                                 $7
   18     9        SEND_VAL                                                 'Foo'
         10        DO_FCALL                                      0  $9      
   13    11        ASSIGN                                                   !1, $9
   21    12        INIT_FCALL                                               'var_dump'
         13        INIT_DYNAMIC_CALL                                        !1
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0  $11     
         16        SEND_VAR                                                 $11
         17        DO_ICALL                                                 
   23    18        NEW                                              $13     'Foo'
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !2, $13
   24    21        INIT_METHOD_CALL                                         !2, 'setBar'
         22        SEND_VAL_EX                                              'TAB%21'
         23        DO_FCALL                                      0          
   26    24        INIT_FCALL                                               'var_dump'
         25        INIT_DYNAMIC_CALL                                        !1
         26        SEND_VAR_EX                                              !2
         27        DO_FCALL                                      0  $17     
         28        SEND_VAR                                                 $17
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FSmsuL%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SmsuL
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'get_object_vars'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   16     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FSmsuL%3A14%240

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

End of function setbar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.73 ms | 1405 KiB | 17 Q