3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add_date($givendate,$day=0,$mth=0,$yr=0) { $cd = strtotime($givendate); $newdate = date('Y-m-d h:i:s', mktime(date('h',$cd), date('i',$cd), date('s',$cd), date('m',$cd)+$mth, date('d',$cd)+$day, date('Y',$cd)+$yr)); return $newdate; } $current_month_first='01'.'-'.date("m").'-'.date("Y"); $current_month_first_stamp=strtotime($current_month_first); $kezdonapszam="5"; $kezdonapszam_int= (int) $kezdonapszam; $kezdonapszam_int=$kezdonapszam_int-1; $kezdo_full=add_date($current_month_first, $kezdonapszam_int); if (strtotime($kezdo_full)<$current_month_first_stamp) {$kezdo_full=add_date($kezdo_full,0,1);} print $kezdo_full; //print date("Y-m-d",$kezdo_full);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 35
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/uqGDT
function name:  (null)
number of ops:  37
compiled vars:  !0 = $current_month_first, !1 = $current_month_first_stamp, !2 = $kezdonapszam, !3 = $kezdonapszam_int, !4 = $kezdo_full
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'm'
          2        DO_ICALL                                         $5      
          3        CONCAT                                           ~6      '01-', $5
          4        CONCAT                                           ~7      ~6, '-'
          5        INIT_FCALL                                               'date'
          6        SEND_VAL                                                 'Y'
          7        DO_ICALL                                         $8      
          8        CONCAT                                           ~9      ~7, $8
          9        ASSIGN                                                   !0, ~9
   13    10        INIT_FCALL                                               'strtotime'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !1, $11
   15    14        ASSIGN                                                   !2, '5'
   18    15        CAST                                          4  ~14     !2
         16        ASSIGN                                                   !3, ~14
   19    17        SUB                                              ~16     !3, 1
         18        ASSIGN                                                   !3, ~16
   21    19        INIT_FCALL                                               'add_date'
         20        SEND_VAR                                                 !0
         21        SEND_VAR                                                 !3
         22        DO_FCALL                                      0  $18     
         23        ASSIGN                                                   !4, $18
   23    24        INIT_FCALL                                               'strtotime'
         25        SEND_VAR                                                 !4
         26        DO_ICALL                                         $20     
         27        IS_SMALLER                                               $20, !1
         28      > JMPZ                                                     ~21, ->35
   24    29    >   INIT_FCALL                                               'add_date'
         30        SEND_VAR                                                 !4
         31        SEND_VAL                                                 0
         32        SEND_VAL                                                 1
         33        DO_FCALL                                      0  $22     
         34        ASSIGN                                                   !4, $22
   26    35    >   ECHO                                                     !4
   28    36      > RETURN                                                   1

Function add_date:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uqGDT
function name:  add_date
number of ops:  50
compiled vars:  !0 = $givendate, !1 = $day, !2 = $mth, !3 = $yr, !4 = $cd, !5 = $newdate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
          2        RECV_INIT                                        !2      0
          3        RECV_INIT                                        !3      0
    4     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !4, $6
    5     8        INIT_FCALL                                               'date'
          9        SEND_VAL                                                 'Y-m-d+h%3Ai%3As'
         10        INIT_FCALL                                               'mktime'
         11        INIT_FCALL                                               'date'
         12        SEND_VAL                                                 'h'
         13        SEND_VAR                                                 !4
         14        DO_ICALL                                         $8      
         15        SEND_VAR                                                 $8
    6    16        INIT_FCALL                                               'date'
         17        SEND_VAL                                                 'i'
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                         $9      
         20        SEND_VAR                                                 $9
         21        INIT_FCALL                                               'date'
         22        SEND_VAL                                                 's'
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                         $10     
         25        SEND_VAR                                                 $10
         26        INIT_FCALL                                               'date'
         27        SEND_VAL                                                 'm'
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                         $11     
         30        ADD                                              ~12     $11, !2
         31        SEND_VAL                                                 ~12
    7    32        INIT_FCALL                                               'date'
         33        SEND_VAL                                                 'd'
         34        SEND_VAR                                                 !4
         35        DO_ICALL                                         $13     
         36        ADD                                              ~14     $13, !1
         37        SEND_VAL                                                 ~14
         38        INIT_FCALL                                               'date'
         39        SEND_VAL                                                 'Y'
         40        SEND_VAR                                                 !4
         41        DO_ICALL                                         $15     
         42        ADD                                              ~16     $15, !3
         43        SEND_VAL                                                 ~16
         44        DO_ICALL                                         $17     
         45        SEND_VAR                                                 $17
         46        DO_ICALL                                         $18     
    5    47        ASSIGN                                                   !5, $18
    8    48      > RETURN                                                   !5
    9    49*     > RETURN                                                   null

End of function add_date

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.08 ms | 1403 KiB | 21 Q