3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = Array( "2" => Array ( "quantity" => 2, "id" => 2 ), "1" => Array ( "quantity" => 1, "id" => 1 ), "3" => Array ( "quantity" => 1, "id" => 3 )); $arr2 = Array( "0" => Array ( "id" => 1, "name" => "2Bed Room", "room" => 6, "bed" => 12, "price" => 2800, "available_room" => 6, "available_bed" => 12, "extra_bed" => 500, ), "1" => Array ( "id" => 2, "name" => "3Bed Room", "room" => 12, "bed" => 36, "price" => 3800, "available_room" => 12, "available_bed" => 36, "extra_bed" => 500, ), "2" => Array ( "id" => 3, "name" => "Dormitory", "room" => 8, "bed" => 16, "price" => 750, "available_room" => 8, "available_bed" => 16, "extra_bed" => 500, )); $arrone = array_column($arr1, "quantity", "id"); $arrtwo = array_column($arr2, "price", "id"); foreach($arrone as $key => $val){ $total[$key] = $arrtwo[$key] * $val; } var_dump($total);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/NLpt9
function name:  (null)
number of ops:  27
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $arrone, !3 = $arrtwo, !4 = $val, !5 = $key, !6 = $total
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN                                                   !1, <array>
   59     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'quantity'
          5        SEND_VAL                                                 'id'
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !2, $9
   60     8        INIT_FCALL                                               'array_column'
          9        SEND_VAR                                                 !1
         10        SEND_VAL                                                 'price'
         11        SEND_VAL                                                 'id'
         12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !3, $11
   62    14      > FE_RESET_R                                       $13     !2, ->22
         15    > > FE_FETCH_R                                       ~14     $13, !4, ->22
         16    >   ASSIGN                                                   !5, ~14
   63    17        FETCH_DIM_R                                      ~17     !3, !5
         18        MUL                                              ~18     !4, ~17
         19        ASSIGN_DIM                                               !6, !5
         20        OP_DATA                                                  ~18
   62    21      > JMP                                                      ->15
         22    >   FE_FREE                                                  $13
   66    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !6
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.06 ms | 1003 KiB | 15 Q