3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hotel = [ [ 'name' => 'hotel one', 'hotel_price' => '100', 'hotel_child_price' => '50' ], [ 'name' => 'hotel two', 'hotel_price' => '200', 'hotel_child_price' => '100' ], [ 'name' => 'hotel three', 'hotel_price' => '300', 'hotel_child_price' => '200' ], ]; $user_selected_hotel = [ [ 'name' => 'hotel one', 'hotel_price' => '100' ], [ 'name' => 'hotel three', 'hotel_price' => '300' ] ]; var_export( array_sum( array_intersect_key( array_column($hotel, 'hotel_child_price', 'name'), array_column($user_selected_hotel, null, 'name') ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/97Onk
function name:  (null)
number of ops:  23
compiled vars:  !0 = $hotel, !1 = $user_selected_hotel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   21     1        ASSIGN                                                   !1, <array>
   32     2        INIT_FCALL                                               'var_export'
   33     3        INIT_FCALL                                               'array_sum'
   34     4        INIT_FCALL                                               'array_intersect_key'
   35     5        INIT_FCALL                                               'array_column'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 'hotel_child_price'
          8        SEND_VAL                                                 'name'
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
   36    11        INIT_FCALL                                               'array_column'
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 null
         14        SEND_VAL                                                 'name'
         15        DO_ICALL                                         $5      
         16        SEND_VAR                                                 $5
   34    17        DO_ICALL                                         $6      
   36    18        SEND_VAR                                                 $6
   33    19        DO_ICALL                                         $7      
   36    20        SEND_VAR                                                 $7
   32    21        DO_ICALL                                                 
   39    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.2 ms | 1013 KiB | 17 Q