3v4l.org

run code in 300+ PHP versions simultaneously
<?php $customer = new stdClass(); $customer->{"first-name"} = "NAME"; $customer->{"last-name"} = "NAME"; $customer->{"phone-numer"} = "NUMBER"; print_r($customer); foreach (get_object_vars($customer) as $key => $value) { $key2 = str_replace('-', '_', $key); $customer->$key2 = $customer->$key; unset($customer->$key); } print_r($customer);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 29
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 29
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/sfZq3
function name:  (null)
number of ops:  34
compiled vars:  !0 = $customer, !1 = $value, !2 = $key, !3 = $key2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    4     3        ASSIGN_OBJ                                               !0, 'first-name'
          4        OP_DATA                                                  'NAME'
    5     5        ASSIGN_OBJ                                               !0, 'last-name'
          6        OP_DATA                                                  'NAME'
    6     7        ASSIGN_OBJ                                               !0, 'phone-numer'
          8        OP_DATA                                                  'NUMBER'
    8     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   10    12        INIT_FCALL                                               'get_object_vars'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $11     
         15      > FE_RESET_R                                       $12     $11, ->29
         16    > > FE_FETCH_R                                       ~13     $12, !1, ->29
         17    >   ASSIGN                                                   !2, ~13
   11    18        INIT_FCALL                                               'str_replace'
         19        SEND_VAL                                                 '-'
         20        SEND_VAL                                                 '_'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $15     
         23        ASSIGN                                                   !3, $15
   12    24        FETCH_OBJ_R                                      ~18     !0, !2
         25        ASSIGN_OBJ                                               !0, !3
         26        OP_DATA                                                  ~18
   13    27        UNSET_OBJ                                                !0, !2
   10    28      > JMP                                                      ->16
         29    >   FE_FREE                                                  $12
   16    30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.75 ms | 1005 KiB | 16 Q