3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = (object)array( 1 => 'value of 1', 'x' => 'value of x', ); function get_real_object_vars($obj) { if (version_compare(PHP_VERSION, '5.0.0') >= 0) { $result = array(); foreach($obj as $key => $value) $result[$key] = $value; return $result; } else { return get_object_vars($obj); } } var_dump($obj, get_real_object_vars($obj));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lTCe
function name:  (null)
number of ops:  10
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   CAST                                          8  ~1      <array>
    2     1        ASSIGN                                                   !0, ~1
   18     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        INIT_FCALL                                               'get_real_object_vars'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

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

End of function get_real_object_vars

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.8 ms | 1399 KiB | 20 Q