3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = 'barValue'; public $baz; public function __construct() { $this->baz = new Baz(); } } class Baz { public $zoo = 'zooValue'; } $foo = new Foo(); function objectToArray($object) { if (is_array($object)) { return array_map('objectToArray', $object); } return (array) $object; } $arrayFoo = objectToArray($foo); var_dump($arrayFoo);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SEdeD
function name:  (null)
number of ops:  11
compiled vars:  !0 = $foo, !1 = $arrayFoo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   15     3        INIT_FCALL                                               'objecttoarray'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !1, $5
   18     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function objecttoarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SEdeD
function name:  objectToArray
number of ops:  11
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~1, ->8
   10     3    >   INIT_FCALL                                               'array_map'
          4        SEND_VAL                                                 'objectToArray'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
   12     8    >   CAST                                          7  ~3      !0
          9      > RETURN                                                   ~3
   13    10*     > RETURN                                                   null

End of function objecttoarray

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SEdeD
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $1      'Baz'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'baz'
          3        OP_DATA                                                  $1
          4      > RETURN                                                   null

End of function __construct

End of class Foo.

Class Baz: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.34 ms | 1399 KiB | 18 Q