3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['2', 163], ['5', 9] ]; $from = 1; $till = 18; $days = array_column($array, 0); $result = array_map(function($day) use ($array, $days) { return (false!==$key=array_search($day, $days))? $array[$key]: [$day, 0]; },range($from, $till)); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/epdQ4
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array, !1 = $from, !2 = $till, !3 = $days, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, 1
    9     2        ASSIGN                                                   !2, 18
   11     3        INIT_FCALL                                               'array_column'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 0
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !3, $8
   12     8        INIT_FCALL                                               'array_map'
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FepdQ4%3A12%240'
         10        BIND_LEXICAL                                             ~10, !0
         11        BIND_LEXICAL                                             ~10, !3
   17    12        SEND_VAL                                                 ~10
         13        INIT_FCALL                                               'range'
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $11     
         17        SEND_VAR                                                 $11
         18        DO_ICALL                                         $12     
   12    19        ASSIGN                                                   !4, $12
   18    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !4
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FepdQ4%3A12%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/epdQ4
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $day, !1 = $array, !2 = $days, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   14     3        INIT_FCALL                                               'array_search'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $4      
          7        ASSIGN                                           ~5      !3, $4
          8        TYPE_CHECK                                  1018          ~5
          9      > JMPZ                                                     ~6, ->13
   15    10    >   FETCH_DIM_R                                      ~7      !1, !3
         11        QM_ASSIGN                                        ~8      ~7
         12      > JMP                                                      ->16
   16    13    >   INIT_ARRAY                                       ~9      !0
         14        ADD_ARRAY_ELEMENT                                ~9      0
         15        QM_ASSIGN                                        ~8      ~9
         16    > > RETURN                                                   ~8
   17    17*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FepdQ4%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.35 ms | 1400 KiB | 23 Q