3v4l.org

run code in 300+ PHP versions simultaneously
<?php $shipArr = [ [ 'ship_cost' => '1', 'country_id' => '1', 'country_code' => 'US', 'country_name' => 'United States', ], [ 'ship_cost' => '0', 'country_id' => '0', 'country_code' => '', 'country_name' => false, ] ]; $user_country_id = 1; var_export( array_find( $shipArr, fn($row) => $row['country_id'] == $user_country_id )['ship_cost'] ?? 0 );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QgLrv
function name:  (null)
number of ops:  15
compiled vars:  !0 = $shipArr, !1 = $user_country_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, 1
   19     2        INIT_FCALL                                               'var_export'
   20     3        INIT_FCALL_BY_NAME                                       'array_find'
   21     4        SEND_VAR_EX                                              !0
   22     5        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          6        BIND_LEXICAL                                             ~4, !1
   23     7        SEND_VAL_EX                                              ~4
   20     8        DO_FCALL                                      0  $5      
   23     9        FETCH_DIM_IS                                     ~6      $5, 'ship_cost'
         10        COALESCE                                         ~7      ~6
         11        QM_ASSIGN                                        ~7      0
         12        SEND_VAL                                                 ~7
   19    13        DO_ICALL                                                 
   24    14      > 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/QgLrv
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $row, !1 = $user_country_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_R                                      ~2      !0, 'country_id'
          3        IS_EQUAL                                         ~3      !1, ~2
          4      > RETURN                                                   ~3
   23     5*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.55 ms | 1010 KiB | 14 Q