3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "data" => "data", "id_1553539135251" => "<p>nsmn</p>", "about" => "about", "id_1553539141598" => "<p>uiu</p>", ]; $result = []; $temp = []; foreach ($array as $k => $v) { if (str_starts_with($k, 'id_')) { $result[$k] = ['content' => $v] + $temp; $temp = []; } else { $temp[$k] = $v; } } var_export($result); /* array:3 [▼ "id_1553539135251" => array:1 [▼ "content" => "<p>nsmn</p>" "data" => "data" ] "id_1553539141598" => array:1 [▼ "content" => "<p>uiu</p>" "about" => "about" ] ] */
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/40pk5
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $result, !2 = $temp, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   11     2        ASSIGN                                                   !2, <array>
   12     3      > FE_RESET_R                                       $8      !0, ->20
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->20
          5    >   ASSIGN                                                   !4, ~9
   13     6        INIT_FCALL                                               'str_starts_with'
          7        SEND_VAR                                                 !4
          8        SEND_VAL                                                 'id_'
          9        DO_ICALL                                         $11     
         10      > JMPZ                                                     $11, ->17
   14    11    >   INIT_ARRAY                                       ~13     !3, 'content'
         12        ADD                                              ~14     ~13, !2
         13        ASSIGN_DIM                                               !1, !4
         14        OP_DATA                                                  ~14
   15    15        ASSIGN                                                   !2, <array>
   13    16      > JMP                                                      ->19
   17    17    >   ASSIGN_DIM                                               !2, !4
         18        OP_DATA                                                  !3
   12    19    > > JMP                                                      ->4
         20    >   FE_FREE                                                  $8
   20    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
   33    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.04 ms | 1002 KiB | 15 Q