3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function getVars($obj) { var_dump(get_object_vars($obj)); } } $obj = (object) array( "\0*\0bar" => 1, "\0Foo\0baz" => 2, ); var_dump(get_object_vars($obj)); (new Foo())->getVars($obj); var_dump(Closure::bind(function ($obj) { var_dump($obj->bar, $obj->baz); }, $obj, 'Foo')->__invoke($obj)); var_dump($obj->{"\0*\0bar"}); var_dump($obj->{"\0Foo*\0baz"});
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U5Fqs
function name:  (null)
number of ops:  35
compiled vars:  !0 = $obj
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  12     1        CAST                                          8  ~2      <array>
         2        ASSIGN                                                   !0, ~2
  16     3        INIT_FCALL                                               'var_dump'
         4        INIT_FCALL                                               'get_object_vars'
         5        SEND_VAR                                                 !0
         6        DO_ICALL                                         $4      
         7        SEND_VAR                                                 $4
         8        DO_ICALL                                                 
  17     9        NEW                                              $6      :-2
        10        DO_FCALL                                      0          
        11        INIT_METHOD_CALL                                         $6, 'getVars'
        12        SEND_VAR_EX                                              !0
        13        DO_FCALL                                      0          
  18    14        INIT_FCALL                                               'var_dump'
        15        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
        16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FU5Fqs0x7efd6e7e513a'
        17        SEND_VAL                                                 ~9
        18        SEND_VAR                                                 !0
        19        SEND_VAL                                                 'Foo'
        20        DO_FCALL                                      0  $10     
        21        INIT_METHOD_CALL                                         $10, '__invoke'
        22        SEND_VAR_EX                                              !0
        23        DO_FCALL                                      0  $11     
        24        SEND_VAR                                                 $11
        25        DO_ICALL                                                 
  19    26        INIT_FCALL                                               'var_dump'
        27        FETCH_OBJ_R                                      $13     !0, '%00%2A%00bar'
        28        SEND_VAR                                                 $13
        29        DO_ICALL                                                 
  20    30        INIT_FCALL                                               'var_dump'
        31        FETCH_OBJ_R                                      $15     !0, '%00Foo%2A%00baz'
        32        SEND_VAR                                                 $15
        33        DO_ICALL                                                 
        34      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FU5Fqs0x7efd6e7e513a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U5Fqs
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $obj
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  18     0  E >   RECV                                             !0      
         1        INIT_FCALL                                               'var_dump'
         2        FETCH_OBJ_R                                      $1      !0, 'bar'
         3        SEND_VAR                                                 $1
         4        FETCH_OBJ_R                                      $2      !0, 'baz'
         5        SEND_VAR                                                 $2
         6        DO_ICALL                                                 
         7      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FU5Fqs0x7efd6e7e513a

Class Foo:
Function getvars:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U5Fqs
function name:  getVars
number of ops:  8
compiled vars:  !0 = $obj
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   5     0  E >   RECV                                             !0      
   7     1        INIT_FCALL                                               'var_dump'
         2        INIT_FCALL                                               'get_object_vars'
         3        SEND_VAR                                                 !0
         4        DO_ICALL                                         $1      
         5        SEND_VAR                                                 $1
         6        DO_ICALL                                                 
   8     7      > RETURN                                                   null

End of function getvars

End of class Foo.

Generated using Vulcan Logic Dumper, using php 7.3.0