3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Count the number of days since the beginning of the year. // // DD:MM:YYYY function dayCount($date) { $day = strtok($date, ":"); print $day . '\n'; $month = strtok(":") - 1; print $month . '\n'; $year = strtok(":"); print $year . '\n'; $months = array(31,28,31,30,31,30,31,31,30,31,30,31); if ($year%4 == 0) { $months[1] = 29; } for ($i = 0; $i < $month; $i++) { $days += $months[$i]; } $days += $day; print $days; } dayCount("31:12:2012"); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y1gc1
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                               'daycount'
          1        SEND_VAL                                                 '31%3A12%3A2012'
          2        DO_FCALL                                      0          
   37     3      > RETURN                                                   1

Function daycount:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 29
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 29
Branch analysis from position: 34
Branch analysis from position: 29
Branch analysis from position: 27
filename:       /in/Y1gc1
function name:  dayCount
number of ops:  37
compiled vars:  !0 = $date, !1 = $day, !2 = $month, !3 = $year, !4 = $months, !5 = $i, !6 = $days
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'strtok'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3A'
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
   10     6        CONCAT                                           ~9      !1, '%5Cn'
          7        ECHO                                                     ~9
   12     8        INIT_FCALL                                               'strtok'
          9        SEND_VAL                                                 '%3A'
         10        DO_ICALL                                         $10     
         11        SUB                                              ~11     $10, 1
         12        ASSIGN                                                   !2, ~11
   13    13        CONCAT                                           ~13     !2, '%5Cn'
         14        ECHO                                                     ~13
   15    15        INIT_FCALL                                               'strtok'
         16        SEND_VAL                                                 '%3A'
         17        DO_ICALL                                         $14     
         18        ASSIGN                                                   !3, $14
   16    19        CONCAT                                           ~16     !3, '%5Cn'
         20        ECHO                                                     ~16
   18    21        ASSIGN                                                   !4, <array>
   20    22        MOD                                              ~18     !3, 4
         23        IS_EQUAL                                                 ~18, 0
         24      > JMPZ                                                     ~19, ->27
   22    25    >   ASSIGN_DIM                                               !4, 1
         26        OP_DATA                                                  29
   25    27    >   ASSIGN                                                   !5, 0
         28      > JMP                                                      ->32
   27    29    >   FETCH_DIM_R                                      ~22     !4, !5
         30        ASSIGN_OP                                     1          !6, ~22
   25    31        PRE_INC                                                  !5
         32    >   IS_SMALLER                                               !5, !2
         33      > JMPNZ                                                    ~25, ->29
   30    34    >   ASSIGN_OP                                     1          !6, !1
   32    35        ECHO                                                     !6
   33    36      > RETURN                                                   null

End of function daycount

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.45 ms | 1403 KiB | 16 Q