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_column( array_uintersect( $hotel, $user_selected_hotel, fn($a, $b) => $a['name'] <=> $b['name'] ), 'hotel_child_price' ) ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GmPY9
function name:  (null)
number of ops:  19
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_column'
   35     5        INIT_FCALL                                               'array_uintersect'
   36     6        SEND_VAR                                                 !0
   37     7        SEND_VAR                                                 !1
   38     8        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   39     9        SEND_VAL                                                 ~4
   35    10        DO_ICALL                                         $5      
   39    11        SEND_VAR                                                 $5
   40    12        SEND_VAL                                                 'hotel_child_price'
   34    13        DO_ICALL                                         $6      
   40    14        SEND_VAR                                                 $6
   33    15        DO_ICALL                                         $7      
   40    16        SEND_VAR                                                 $7
   32    17        DO_ICALL                                                 
   43    18      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GmPY9
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        FETCH_DIM_R                                      ~2      !0, 'name'
          3        FETCH_DIM_R                                      ~3      !1, 'name'
          4        SPACESHIP                                        ~4      ~2, ~3
          5      > RETURN                                                   ~4
   39     6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.35 ms | 1013 KiB | 17 Q