3v4l.org

run code in 300+ PHP versions simultaneously
<?php $k = 201435; $str = strval($k); $year = intval(substr($str,0,4)); $month = intval(substr($str,4)); while($month>12){ $month = $month-12; $year++; } $formatted = intval(strval($year).str_pad(strval($month), 2, "0", STR_PAD_LEFT)); var_dump($month, $year, $formatted);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 17
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 17
Branch analysis from position: 22
Branch analysis from position: 17
filename:       /in/HrJtA
function name:  (null)
number of ops:  39
compiled vars:  !0 = $k, !1 = $str, !2 = $year, !3 = $month, !4 = $formatted
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 201435
    4     1        CAST                                          6  ~6      !0
          2        ASSIGN                                                   !1, ~6
    5     3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !1
          5        SEND_VAL                                                 0
          6        SEND_VAL                                                 4
          7        DO_ICALL                                         $8      
          8        CAST                                          4  ~9      $8
          9        ASSIGN                                                   !2, ~9
    6    10        INIT_FCALL                                               'substr'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 4
         13        DO_ICALL                                         $11     
         14        CAST                                          4  ~12     $11
         15        ASSIGN                                                   !3, ~12
    7    16      > JMP                                                      ->20
    8    17    >   SUB                                              ~14     !3, 12
         18        ASSIGN                                                   !3, ~14
    9    19        PRE_INC                                                  !2
    7    20    >   IS_SMALLER                                               12, !3
         21      > JMPNZ                                                    ~17, ->17
   11    22    >   CAST                                          6  ~18     !2
         23        INIT_FCALL                                               'str_pad'
         24        CAST                                          6  ~19     !3
         25        SEND_VAL                                                 ~19
         26        SEND_VAL                                                 2
         27        SEND_VAL                                                 '0'
         28        SEND_VAL                                                 0
         29        DO_ICALL                                         $20     
         30        CONCAT                                           ~21     ~18, $20
         31        CAST                                          4  ~22     ~21
         32        ASSIGN                                                   !4, ~22
   13    33        INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !3
         35        SEND_VAR                                                 !2
         36        SEND_VAR                                                 !4
         37        DO_ICALL                                                 
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.28 ms | 1396 KiB | 19 Q