3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = ['2018-05'=> '15', '2018-06'=> '100']; $b = ['2018-05'=> '5']; $years = array_map(NULL, $a, $b); $years = array_combine(array_keys($a), $years); $differences = array_map(function ($year_diffs) : float { // Did we get a pair to compare? $has_diff = isset($year_diffs[0]) and isset($year_diffs[1]); // If we got a pair then compare, else assume we got one. $diff = $has_diff ? abs($year_diffs[0] - $year_diffs[1]) : $year_diffs[0]; return $diff; }, $years); var_dump($differences);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BSEui
function name:  (null)
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $years, !3 = $differences
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_map'
          3        SEND_VAL                                                 null
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
    7     8        INIT_FCALL                                               'array_combine'
          9        INIT_FCALL                                               'array_keys'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $8      
         12        SEND_VAR                                                 $8
         13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $9      
         15        ASSIGN                                                   !2, $9
    9    16        INIT_FCALL                                               'array_map'
         17        DECLARE_LAMBDA_FUNCTION                          ~11     [0]
   18    18        SEND_VAL                                                 ~11
         19        SEND_VAR                                                 !2
    9    20        DO_ICALL                                         $12     
         21        ASSIGN                                                   !3, $12
   20    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                                 
         25      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/BSEui
function name:  {closure}
number of ops:  22
compiled vars:  !0 = $year_diffs, !1 = $has_diff, !2 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   12     1        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !0, 0
          2        ASSIGN                                           ~4      !1, ~3
          3      > JMPZ_EX                                          ~4      ~4, ->6
          4    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~5      !0, 1
          5        BOOL                                             ~4      ~5
   15     6    > > JMPZ                                                     !1, ->15
          7    >   INIT_FCALL                                               'abs'
          8        FETCH_DIM_R                                      ~6      !0, 0
          9        FETCH_DIM_R                                      ~7      !0, 1
         10        SUB                                              ~8      ~6, ~7
         11        SEND_VAL                                                 ~8
         12        DO_ICALL                                         $9      
         13        QM_ASSIGN                                        ~10     $9
         14      > JMP                                                      ->17
         15    >   FETCH_DIM_R                                      ~11     !0, 0
         16        QM_ASSIGN                                        ~10     ~11
         17    >   ASSIGN                                                   !2, ~10
   17    18        VERIFY_RETURN_TYPE                                       !2
         19      > RETURN                                                   !2
   18    20*       VERIFY_RETURN_TYPE                                       
         21*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.17 ms | 1011 KiB | 18 Q