3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ["04" => 1, "09" => 1, "10" => 1, "01" => 1]; for ($x = 1; $x < 11; ++$x) { $key = sprintf("%02d", $x); // ensure proper padding with 0 $result[$key] = $data[$key] ?? 0; // null coalescing operator from php5.6+ } print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
Branch analysis from position: 3
filename:       /in/kYHY6
function name:  (null)
number of ops:  20
compiled vars:  !0 = $data, !1 = $x, !2 = $key, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 1
          2      > JMP                                                      ->14
    5     3    >   INIT_FCALL                                               'sprintf'
          4        SEND_VAL                                                 '%2502d'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !2, $6
    6     8        FETCH_DIM_IS                                     ~9      !0, !2
          9        COALESCE                                         ~10     ~9
         10        QM_ASSIGN                                        ~10     0
         11        ASSIGN_DIM                                               !3, !2
         12        OP_DATA                                                  ~10
    4    13        PRE_INC                                                  !1
         14    >   IS_SMALLER                                               !1, 11
         15      > JMPNZ                                                    ~12, ->3
    9    16    >   INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.3 ms | 1011 KiB | 15 Q