3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = ['user_firstname' => 'Jack', 'user_lastname' => 'Smith', 'user_address_1' => '123']; $Arraydata = []; foreach($array1 as $key=>$value){ $data = explode("_", $key, 2)[1]; if($data === 'firstname'){ $Arraydata['firstname'] = $value; } if($data === 'lastname'){ $Arraydata['lastname'] = $value; } if($data === 'address_1'){ $Arraydata['address_1'] = $value; } } print_r($Arraydata);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 25
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 24
Branch analysis from position: 20
Branch analysis from position: 16
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/AYZ7H
function name:  (null)
number of ops:  30
compiled vars:  !0 = $array1, !1 = $Arraydata, !2 = $value, !3 = $key, !4 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $7      !0, ->25
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->25
          4    >   ASSIGN                                                   !3, ~8
    6     5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '_'
          7        SEND_VAR                                                 !3
          8        SEND_VAL                                                 2
          9        DO_ICALL                                         $10     
         10        FETCH_DIM_R                                      ~11     $10, 1
         11        ASSIGN                                                   !4, ~11
    8    12        IS_IDENTICAL                                             !4, 'firstname'
         13      > JMPZ                                                     ~13, ->16
    9    14    >   ASSIGN_DIM                                               !1, 'firstname'
         15        OP_DATA                                                  !2
   12    16    >   IS_IDENTICAL                                             !4, 'lastname'
         17      > JMPZ                                                     ~15, ->20
   13    18    >   ASSIGN_DIM                                               !1, 'lastname'
         19        OP_DATA                                                  !2
   16    20    >   IS_IDENTICAL                                             !4, 'address_1'
         21      > JMPZ                                                     ~17, ->24
   17    22    >   ASSIGN_DIM                                               !1, 'address_1'
         23        OP_DATA                                                  !2
    5    24    > > JMP                                                      ->3
         25    >   FE_FREE                                                  $7
   21    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.65 ms | 1401 KiB | 17 Q