3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( '0' => Array ( 'created_at' => 1991, 'updated_at' => 1992, 'customer_name' => 'john doe', 'line_items' => Array ( '0' => Array ( 'name' => 'Hello world poduct', 'price' => 800.00, 'id' => 123, 'quantity' => 2 ), '1' => Array ( 'name' => 'Hello world product 2', 'price' => 100.00, 'id' => 456, 'quantity' => 1 ) ) ), '1' => Array ( 'created_at' => 1992, 'updated_at' => 1993, 'customer_name' => 'Guido van Rossum', 'line_items' => Array ( '0' => Array ( 'name' => 'Hello world product', 'price' => 800.00, 'id' => 123, 'quantity' => 2 ), '1' => Array ( 'name' => 'Hello world poduct 2', 'price' => 100.00, 'id' => 456, 'quantity' => 3 ), '2' => Array ( 'name' => 'Hello world poduct 3', 'price' => 400.00, 'id' => 116, 'quantity' => 5 ) ) ) ); $result = []; foreach ($array as ['line_items' => $items]) { foreach ($items as ['quantity' => $result[]]); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 16
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/ZfYH2
function name:  (null)
number of ops:  21
compiled vars:  !0 = $array, !1 = $result, !2 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   63     1        ASSIGN                                                   !1, <array>
   64     2      > FE_RESET_R                                       $5      !0, ->16
          3    > > FE_FETCH_R                                               $5, $6, ->16
          4    >   FETCH_LIST_R                                     $7      $6, 'line_items'
          5        ASSIGN                                                   !2, $7
          6        FREE                                                     $6
   65     7      > FE_RESET_R                                       $9      !2, ->14
          8    > > FE_FETCH_R                                               $9, $10, ->14
          9    >   FETCH_LIST_R                                     $11     $10, 'quantity'
         10        ASSIGN_DIM                                               !1
         11        OP_DATA                                                  $11
         12        FREE                                                     $10
         13      > JMP                                                      ->8
         14    >   FE_FREE                                                  $9
   64    15      > JMP                                                      ->3
         16    >   FE_FREE                                                  $5
   67    17        INIT_FCALL                                               'var_export'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.79 ms | 1010 KiB | 14 Q