3v4l.org

run code in 500+ PHP versions simultaneously
<?php $customerProptype = (object)array ( 'first-name' => 'maria', 'last-name' => 'magdalena', 'phone-number' => 'no phone service', ); $customer = clone $customerProptype; foreach ($customer as $key => $value) { $key2 = str_replace('-', '_', $key); if ($key2 !== $key) { $customer->$key2 = $customer->$key; unset($customer->$key); } } var_export($customer, false); $customer = clone $customerProptype; foreach ($customer as $key => $value) { $key2 = str_replace('-', '_', $key); if ($key2 === $key) { continue; // nothing to do } $customer->$key2 = $customer->$key; unset($customer->$key); } var_export($customer, false); $customer = clone $customerProptype; foreach (clone $customer as $key => $value) { $key2 = str_replace('-', '_', $key); unset($customer->$key); $customer->$key2 = $value; } var_export($customer, false);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 16
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 38
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 38
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 33
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 38
2 jumps found. (Code = 77) Position 1 = 47, Position 2 = 56
Branch analysis from position: 47
2 jumps found. (Code = 78) Position 1 = 48, Position 2 = 56
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
Branch analysis from position: 38
Branch analysis from position: 17
filename:       /in/vEXDj
function name:  (null)
number of ops:  62
compiled vars:  !0 = $customerProptype, !1 = $customer, !2 = $value, !3 = $key, !4 = $key2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   CAST                                              8  ~5      <array>
    3     1        ASSIGN                                                       !0, ~5
   10     2        CLONE                                                ~7      !0
          3        ASSIGN                                                       !1, ~7
   12     4      > FE_RESET_R                                           $9      !1, ->17
          5    > > FE_FETCH_R                                           ~10     $9, !2, ->17
          6    >   ASSIGN                                                       !3, ~10
   13     7        FRAMELESS_ICALL_3                str_replace         ~12     '-', '_'
          8        OP_DATA                                                      !3
          9        ASSIGN                                                       !4, ~12
   14    10        IS_NOT_IDENTICAL                                             !4, !3
         11      > JMPZ                                                         ~14, ->16
   15    12    >   FETCH_OBJ_R                                          ~16     !1, !3
         13        ASSIGN_OBJ                                                   !1, !4
         14        OP_DATA                                                      ~16
   16    15        UNSET_OBJ                                                    !1, !3
   12    16    > > JMP                                                          ->5
         17    >   FE_FREE                                                      $9
   20    18        INIT_FCALL                                                   'var_export'
         19        SEND_VAR                                                     !1
         20        SEND_VAL                                                     <false>
         21        DO_ICALL                                                     
   23    22        CLONE                                                ~18     !0
         23        ASSIGN                                                       !1, ~18
   25    24      > FE_RESET_R                                           $20     !1, ->38
         25    > > FE_FETCH_R                                           ~21     $20, !2, ->38
         26    >   ASSIGN                                                       !3, ~21
   26    27        FRAMELESS_ICALL_3                str_replace         ~23     '-', '_'
         28        OP_DATA                                                      !3
         29        ASSIGN                                                       !4, ~23
   27    30        IS_IDENTICAL                                                 !4, !3
         31      > JMPZ                                                         ~25, ->33
   28    32    > > JMP                                                          ->25
   30    33    >   FETCH_OBJ_R                                          ~27     !1, !3
         34        ASSIGN_OBJ                                                   !1, !4
         35        OP_DATA                                                      ~27
   31    36        UNSET_OBJ                                                    !1, !3
   25    37      > JMP                                                          ->25
         38    >   FE_FREE                                                      $20
   34    39        INIT_FCALL                                                   'var_export'
         40        SEND_VAR                                                     !1
         41        SEND_VAL                                                     <false>
         42        DO_ICALL                                                     
   36    43        CLONE                                                ~29     !0
         44        ASSIGN                                                       !1, ~29
   38    45        CLONE                                                ~31     !1
         46      > FE_RESET_R                                           $32     ~31, ->56
         47    > > FE_FETCH_R                                           ~33     $32, !2, ->56
         48    >   ASSIGN                                                       !3, ~33
   39    49        FRAMELESS_ICALL_3                str_replace         ~35     '-', '_'
         50        OP_DATA                                                      !3
         51        ASSIGN                                                       !4, ~35
   40    52        UNSET_OBJ                                                    !1, !3
   41    53        ASSIGN_OBJ                                                   !1, !4
         54        OP_DATA                                                      !2
   38    55      > JMP                                                          ->47
         56    >   FE_FREE                                                      $32
   44    57        INIT_FCALL                                                   'var_export'
         58        SEND_VAR                                                     !1
         59        SEND_VAL                                                     <false>
         60        DO_ICALL                                                     
         61      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.18 ms | 1919 KiB | 14 Q