3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ (object)[ 'driver_id' => 2, 'total' => 308, 'total_driver' => 5, 'score1' => 61.6000, 'score2' => 62, ], (object)[ 'driver_id' => 3, 'total' => 354, 'total_driver' => 5, 'score1' => 70.8000, 'score2' => 71, ], ]; $array2 = [ [ 'driver_id' => 2, 'recommendation_min' => 0, 'recommendation_max' => 50, 'recommendation_key_range' => 'Low', 'recommendation_observation' => 'Low', 'recommendation_' => 'Low', ], [ 'driver_id' => 2, 'recommendation_min' => 51, 'recommendation_max' => 78, 'recommendation_key_range' => 'Moderate', 'recommendation_observation' => 'Moderate', 'recommendation_' => 'Moderate', ], ]; var_export( array_map( fn($obj) => (object)array_merge( array_find( $array2, fn($row) => $obj->driver_id == $row['driver_id'] && $obj->score2 >= $row['recommendation_min'] && $obj->score2 <= $row['recommendation_max'] ) ?? [], (array)$obj ), $array1 ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TAXYr
function name:  (null)
number of ops:  17
compiled vars:  !0 = $array1, !1 = $array2, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   CAST                                          8  ~3      <array>
          1        INIT_ARRAY                                       ~4      ~3
   12     2        CAST                                          8  ~5      <array>
          3        ADD_ARRAY_ELEMENT                                ~4      ~5
    3     4        ASSIGN                                                   !0, ~4
   20     5        ASSIGN                                                   !1, <array>
   39     6        INIT_FCALL                                               'var_export'
   40     7        INIT_FCALL                                               'array_map'
   41     8        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
          9        BIND_LEXICAL                                             ~8, !1
         10        BIND_LEXICAL                                             ~8, !2
   49    11        SEND_VAL                                                 ~8
   50    12        SEND_VAR                                                 !0
   40    13        DO_ICALL                                         $9      
   50    14        SEND_VAR                                                 $9
   39    15        DO_ICALL                                                 
   52    16      > 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/TAXYr
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $obj, !1 = $array2, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
          3        INIT_FCALL                                               'array_merge'
   42     4        INIT_FCALL_BY_NAME                                       'array_find'
   43     5        SEND_VAR_EX                                              !1
   44     6        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          7        BIND_LEXICAL                                             ~3, !0
   47     8        SEND_VAL_EX                                              ~3
   42     9        DO_FCALL                                      0  $4      
   47    10        COALESCE                                         ~5      $4
         11        QM_ASSIGN                                        ~5      <array>
         12        SEND_VAL                                                 ~5
   48    13        CAST                                          7  ~6      !0
         14        SEND_VAL                                                 ~6
   41    15        DO_ICALL                                         $7      
   48    16        CAST                                          8  ~8      $7
         17      > RETURN                                                   ~8
   49    18*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 10
filename:       /in/TAXYr
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $row, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_OBJ_R                                      ~2      !1, 'driver_id'
          3        FETCH_DIM_R                                      ~3      !0, 'driver_id'
          4        IS_EQUAL                                         ~4      ~2, ~3
          5      > JMPZ_EX                                          ~4      ~4, ->10
   45     6    >   FETCH_OBJ_R                                      ~5      !1, 'score2'
          7        FETCH_DIM_R                                      ~6      !0, 'recommendation_min'
          8        IS_SMALLER_OR_EQUAL                              ~7      ~6, ~5
          9        BOOL                                             ~4      ~7
         10    > > JMPZ_EX                                          ~4      ~4, ->15
   46    11    >   FETCH_OBJ_R                                      ~8      !1, 'score2'
         12        FETCH_DIM_R                                      ~9      !0, 'recommendation_max'
         13        IS_SMALLER_OR_EQUAL                              ~10     ~8, ~9
         14        BOOL                                             ~4      ~10
         15    > > RETURN                                                   ~4
   47    16*     > RETURN                                                   null

End of Dynamic Function 0

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.86 ms | 1017 KiB | 16 Q