3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testString = <<<EOF id1 name1 lastname1 age1 birthdate1 id2 name2 lastname2 age2 birthdate2 id3 name3 lastname3 age3 birthdate3 id4 name4 lastname4 age4 birthdate4 EOF; $stringArray = explode("\n", $testString); $finalArray = array(); foreach ($stringArray as $lineNo => $line) { $strArray = str_getcsv($line, ' ', ''); $firstVal = array_shift($strArray); $finalArray[$firstVal] = array_combine(array( 'name', 'lastname', 'age', 'birthdate' ),$strArray ); } print_r($finalArray);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 27
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 27
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/ZWWfE
function name:  (null)
number of ops:  32
compiled vars:  !0 = $testString, !1 = $stringArray, !2 = $finalArray, !3 = $line, !4 = $lineNo, !5 = $strArray, !6 = $firstVal
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'id1+name1+lastname1+age1+birthdate1%0Aid2+name2+lastname2+age2+birthdate2%0Aid3+name3+lastname3+age3+birthdate3%0Aid4+name4+lastname4+age4+birthdate4'
   11     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
   12     6        ASSIGN                                                   !2, <array>
   13     7      > FE_RESET_R                                       $11     !1, ->27
          8    > > FE_FETCH_R                                       ~12     $11, !3, ->27
          9    >   ASSIGN                                                   !4, ~12
   14    10        INIT_FCALL                                               'str_getcsv'
         11        SEND_VAR                                                 !3
         12        SEND_VAL                                                 '+'
         13        SEND_VAL                                                 ''
         14        DO_ICALL                                         $14     
         15        ASSIGN                                                   !5, $14
   15    16        INIT_FCALL                                               'array_shift'
         17        SEND_REF                                                 !5
         18        DO_ICALL                                         $16     
         19        ASSIGN                                                   !6, $16
   16    20        INIT_FCALL                                               'array_combine'
   17    21        SEND_VAL                                                 <array>
   21    22        SEND_VAR                                                 !5
   16    23        DO_ICALL                                         $19     
         24        ASSIGN_DIM                                               !2, !6
   21    25        OP_DATA                                                  $19
   13    26      > JMP                                                      ->8
         27    >   FE_FREE                                                  $11
   24    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.61 ms | 1007 KiB | 18 Q