3v4l.org

run code in 300+ PHP versions simultaneously
<?php $first = [ '01-1970' => 0.00, '03-2019' => 4350.00, '05-2019' => 150.00, '06-2019' => 50.00, ]; $second = [ '03-2019' => 0.00, '04-2019' => 0.00, '06-2019' => 34.83, ]; $result = $first; foreach ($second as $k => $v) { $result[$k] = ($result[$k] ?? 0) + $v; } uksort( $result, fn($a, $b) => preg_replace('/(\d+)-(\d+)/', '$2-$1', $a) <=> preg_replace('/(\d+)-(\d+)/', '$2-$1', $b) ); var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/SXI6Br
function name:  (null)
number of ops:  23
compiled vars:  !0 = $first, !1 = $second, !2 = $result, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   16     2        ASSIGN                                                   !2, !0
   17     3      > FE_RESET_R                                       $8      !1, ->13
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->13
          5    >   ASSIGN                                                   !4, ~9
   18     6        FETCH_DIM_IS                                     ~12     !2, !4
          7        COALESCE                                         ~13     ~12
          8        QM_ASSIGN                                        ~13     0
          9        ADD                                              ~14     ~13, !3
         10        ASSIGN_DIM                                               !2, !4
         11        OP_DATA                                                  ~14
   17    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $8
   20    14        INIT_FCALL                                               'uksort'
   21    15        SEND_REF                                                 !2
   22    16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FSXI6Br%3A22%240'
   25    17        SEND_VAL                                                 ~15
         18        DO_ICALL                                                 
   26    19        INIT_FCALL                                               'var_export'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FSXI6Br%3A22%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SXI6Br
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%28%5Cd%2B%29-%28%5Cd%2B%29%2F'
          4        SEND_VAL                                                 '%242-%241'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
   24     7        INIT_FCALL                                               'preg_replace'
          8        SEND_VAL                                                 '%2F%28%5Cd%2B%29-%28%5Cd%2B%29%2F'
          9        SEND_VAL                                                 '%242-%241'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $3      
         12        SPACESHIP                                        ~4      $2, $3
         13      > RETURN                                                   ~4
   25    14*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FSXI6Br%3A22%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.03 ms | 1405 KiB | 19 Q