3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array ( 0 => array ( 'id' => 4, 'day_of_week' => 'sun', 'description' => 'suntestdescription', 'status' => 0, 'date' => '2019-01-11' ), 1 => array ( 'id' => 5, 'day_of_week' => 'mon', 'description' => 'montestdescription', 'status' => 0, 'date' => '2019-01-11' ) ); $array2 = array ( 0 => array ( 'id' => 1, 'day_of_week' => 'mon', 'description' => 'monupdatedtestdescription', 'status' => 1, 'date' => '2019-01-11' ) ); $array1 = array_map(function ($v) use ($array2) { if (($k = array_search($v['day_of_week'], array_column($array2, 'day_of_week'))) !== false && $array2[$k]['status'] == 1) return $array2[$k]; else return $v; }, $array1); print_r($array1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vSP5s
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array1, !1 = $array2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   21     1        ASSIGN                                                   !1, <array>
   31     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          4        BIND_LEXICAL                                             ~4, !1
   36     5        SEND_VAL                                                 ~4
          6        SEND_VAR                                                 !0
   31     7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !0, $5
   37     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/vSP5s
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $v, !1 = $array2, !2 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   32     2        INIT_FCALL                                               'array_search'
          3        FETCH_DIM_R                                      ~3      !0, 'day_of_week'
          4        SEND_VAL                                                 ~3
          5        INIT_FCALL                                               'array_column'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 'day_of_week'
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                         $5      
         11        ASSIGN                                           ~6      !2, $5
         12        TYPE_CHECK                                  1018  ~7      ~6
         13      > JMPZ_EX                                          ~7      ~7, ->18
         14    >   FETCH_DIM_R                                      ~8      !1, !2
         15        FETCH_DIM_R                                      ~9      ~8, 'status'
         16        IS_EQUAL                                         ~10     ~9, 1
         17        BOOL                                             ~7      ~10
         18    > > JMPZ                                                     ~7, ->22
   33    19    >   FETCH_DIM_R                                      ~11     !1, !2
         20      > RETURN                                                   ~11
   32    21*       JMP                                                      ->23
   35    22    > > RETURN                                                   !0
   36    23*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.39 ms | 1008 KiB | 17 Q