3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $foo = 'foo'; protected $bar = 'two'; private $baz = 'three'; } function objectToArray($obj) { if (is_array($obj)) { return $obj; } $array = (array) $obj; $result = array(); foreach($array as $key => $value) { $result[$key] = $value; } return $result; } $b = objectToArray(new Foo()); var_dump($b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y8bhe
function name:  (null)
number of ops:  10
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'objecttoarray'
          1        NEW                                              $1      'Foo'
          2        DO_FCALL                                      0          
          3        SEND_VAR                                                 $1
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !0, $3
   26     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function objecttoarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/Y8bhe
function name:  objectToArray
number of ops:  16
compiled vars:  !0 = $obj, !1 = $array, !2 = $result, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~5, ->4
   12     3    > > RETURN                                                   !0
   14     4    >   CAST                                          7  ~6      !0
          5        ASSIGN                                                   !1, ~6
   15     6        ASSIGN                                                   !2, <array>
   17     7      > FE_RESET_R                                       $9      !1, ->13
          8    > > FE_FETCH_R                                       ~10     $9, !3, ->13
          9    >   ASSIGN                                                   !4, ~10
   18    10        ASSIGN_DIM                                               !2, !4
         11        OP_DATA                                                  !3
   17    12      > JMP                                                      ->8
         13    >   FE_FREE                                                  $9
   21    14      > RETURN                                                   !2
   22    15*     > RETURN                                                   null

End of function objecttoarray

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.05 ms | 1403 KiB | 16 Q