3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[AllowDynamicProperties] class WP_Term { public $term_id; /** * Converts an object to array. * * @since 4.4.0 * * @return array Object as array. */ public function to_array() { return get_object_vars( $this ); } } $term = new WP_Term(); $term->term_id = 5; $term->foo = 'foo'; $term->bar = 'bar'; echo "Direct type cast to `(array)`\n"; var_dump( (array) $term ); echo "\n\nUsing to_array()\n"; var_dump( $term->to_array() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPLfu
function name:  (null)
number of ops:  21
compiled vars:  !0 = $term
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'WP_Term'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        ASSIGN_OBJ                                               !0, 'term_id'
          4        OP_DATA                                                  5
   21     5        ASSIGN_OBJ                                               !0, 'foo'
          6        OP_DATA                                                  'foo'
   22     7        ASSIGN_OBJ                                               !0, 'bar'
          8        OP_DATA                                                  'bar'
   24     9        ECHO                                                     'Direct+type+cast+to+%60%28array%29%60%0A'
   25    10        INIT_FCALL                                               'var_dump'
         11        CAST                                          7  ~7      !0
         12        SEND_VAL                                                 ~7
         13        DO_ICALL                                                 
   27    14        ECHO                                                     '%0A%0AUsing+to_array%28%29%0A'
   28    15        INIT_FCALL                                               'var_dump'
         16        INIT_METHOD_CALL                                         !0, 'to_array'
         17        DO_FCALL                                      0  $9      
         18        SEND_VAR                                                 $9
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Class WP_Term:
Function to_array:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IPLfu
function name:  to_array
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'get_object_vars'
          1        FETCH_THIS                                       ~0      
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   16     5*     > RETURN                                                   null

End of function to_array

End of class WP_Term.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.59 ms | 1000 KiB | 15 Q