3v4l.org

run code in 300+ PHP versions simultaneously
<?php function e($o){return json_decode(preg_replace('/\\\u0000[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\u0000/','',json_encode((array)$o)),1);} class Foo { public function test() { echo 'test'; } } function changeMe(&$obj) { $obj = function(){ echo 'hello'; }; //$reflectionClass = new ReflectionClass($obj); //var_dump($reflectionClass); $arr = (array) $obj; $obj = (object) $arr; var_dump($arr, $obj); //$out = json_encode($arr); //$out = preg_replace('/\\\u0000[*a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\\\u0000/', '', $out); //echo $out . PHP_EOL; //$newArray = json_decode($out, true); //var_dump($arr, $newArray); } $foo = new Foo(); changeMe($foo); $foo->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X8AFt
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   36     3        INIT_FCALL                                               'changeme'
          4        SEND_REF                                                 !0
          5        DO_FCALL                                      0          
   38     6        INIT_METHOD_CALL                                         !0, 'test'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function e:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X8AFt
function name:  e
number of ops:  16
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'json_decode'
          2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5C%5Cu0000%5B%2Aa-zA-Z_%5Cx7f-%5Cxff%5D%5Ba-zA-Z0-9_%5Cx7f-%5Cxff%5D%2A%5C%5Cu0000%2F'
          4        SEND_VAL                                                 ''
          5        INIT_FCALL                                               'json_encode'
          6        CAST                                          7  ~1      !0
          7        SEND_VAL                                                 ~1
          8        DO_ICALL                                         $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                         $3      
         11        SEND_VAR                                                 $3
         12        SEND_VAL                                                 1
         13        DO_ICALL                                         $4      
         14      > RETURN                                                   $4
         15*     > RETURN                                                   null

End of function e

Function changeme:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X8AFt
function name:  changeMe
number of ops:  12
compiled vars:  !0 = $obj, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FX8AFt%3A15%240'
          2        ASSIGN                                                   !0, ~2
   20     3        CAST                                          7  ~4      !0
          4        ASSIGN                                                   !1, ~4
   22     5        CAST                                          8  ~6      !1
          6        ASSIGN                                                   !0, ~6
   24     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   32    11      > RETURN                                                   null

End of function changeme

Function %00%7Bclosure%7D%2Fin%2FX8AFt%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X8AFt
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ECHO                                                     'hello'
   17     1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FX8AFt%3A15%240

Class Foo:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/X8AFt
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'test'
   10     1      > RETURN                                                   null

End of function test

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.27 ms | 1403 KiB | 22 Q