3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ ['customer_id' => 1, 'Expire' => '2019-05-14', 'paid' => 1], ['customer_id' => 2, 'Expire' => '2019-06-20', 'paid' => 0], ['customer_id' => 2, 'Expire' => '2019-06-21', 'paid' => 1], ]; $arr2 = [ ['id' => 3943, 'customer_id' => 1, 'Expire' => '2019-05-14'], ['id' => 3944, 'customer_id' => 1, 'Expire' => '2019-05-14'], ['id' => 4713, 'customer_id' => 2, 'Expire' => '2019-06-20'], ['id' => 4714, 'customer_id' => 2, 'Expire' => '2019-06-21'] ]; foreach ($arr2 as &$a) { $customerID = $a['customer_id']; $arr1_key = array_search($customerID, array_column($arr1, 'customer_id')); $paid = $arr1[$arr1_key]['paid']; $a['paid'] = $paid; } print_r($arr2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 126) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/TeTpK
function name:  (null)
number of ops:  26
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $a, !3 = $customerID, !4 = $arr1_key, !5 = $paid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   16     2      > FE_RESET_RW                                      $8      !1, ->21
          3    > > FE_FETCH_RW                                              $8, !2, ->21
   17     4    >   FETCH_DIM_R                                      ~9      !2, 'customer_id'
          5        ASSIGN                                                   !3, ~9
   18     6        INIT_FCALL                                               'array_search'
          7        SEND_VAR                                                 !3
          8        INIT_FCALL                                               'array_column'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 'customer_id'
         11        DO_ICALL                                         $11     
         12        SEND_VAR                                                 $11
         13        DO_ICALL                                         $12     
         14        ASSIGN                                                   !4, $12
   19    15        FETCH_DIM_R                                      ~14     !0, !4
         16        FETCH_DIM_R                                      ~15     ~14, 'paid'
         17        ASSIGN                                                   !5, ~15
   20    18        ASSIGN_DIM                                               !2, 'paid'
         19        OP_DATA                                                  !5
   16    20      > JMP                                                      ->3
         21    >   FE_FREE                                                  $8
   23    22        INIT_FCALL                                               'print_r'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.34 ms | 1395 KiB | 19 Q