3v4l.org

run code in 300+ PHP versions simultaneously
<?php class dateCalculation { public $use_date; function __construct($date=null) { if(!empty($date)) { $this->$use_date = $date; } else { $this->$use_date = date('Y-m-d H:i:s'); } } public function validNextDrawDate() { $next_valid_date_time_1 = strtotime('this wednesday 20:00'); $next_valid_date_time_2 = strtotime('this saturday 20:00'); if(strtotime($this->$use_date) < $next_valid_date_time_1) { // Past wednesday 20:00 of this week. $appointment_date_time = $next_valid_date_time_1; } else { $appointment_date_time = $next_valid_date_time_2; } echo date('Y-m-d H:i', $appointment_date_time); } } echo date('Y-m-d H:i:s'); $dateCalculation = new dateCalculation(date('Y-m-d H:i:s')); echo $dateCalculation->validNextDrawDate();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rKG6r
function name:  (null)
number of ops:  15
compiled vars:  !0 = $dateCalculation
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          2        DO_ICALL                                         $1      
          3        ECHO                                                     $1
   33     4        NEW                                              $2      'dateCalculation'
          5        INIT_FCALL                                               'date'
          6        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          7        DO_ICALL                                         $3      
          8        SEND_VAR_NO_REF_EX                                       $3
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $2
   35    11        INIT_METHOD_CALL                                         !0, 'validNextDrawDate'
         12        DO_FCALL                                      0  $6      
         13        ECHO                                                     $6
         14      > RETURN                                                   1

Class dateCalculation:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rKG6r
function name:  __construct
number of ops:  13
compiled vars:  !0 = $date, !1 = $use_date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV_INIT                                        !0      null
    9     1        ISSET_ISEMPTY_CV                                 ~2      !0
          2        BOOL_NOT                                         ~3      ~2
          3      > JMPZ                                                     ~3, ->7
   10     4    >   ASSIGN_OBJ                                               !1
          5        OP_DATA                                                  !0
          6      > JMP                                                      ->12
   12     7    >   INIT_FCALL                                               'date'
          8        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          9        DO_ICALL                                         $6      
         10        ASSIGN_OBJ                                               !1
         11        OP_DATA                                                  $6
   14    12    > > RETURN                                                   null

End of function __construct

Function validnextdrawdate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rKG6r
function name:  validNextDrawDate
number of ops:  23
compiled vars:  !0 = $next_valid_date_time_1, !1 = $next_valid_date_time_2, !2 = $use_date, !3 = $appointment_date_time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 'this+wednesday+20%3A00'
          2        DO_ICALL                                         $4      
          3        ASSIGN                                                   !0, $4
   18     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAL                                                 'this+saturday+20%3A00'
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !1, $6
   20     8        INIT_FCALL                                               'strtotime'
          9        FETCH_OBJ_R                                      ~8      !2
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                         $9      
         12        IS_SMALLER                                               $9, !0
         13      > JMPZ                                                     ~10, ->16
   22    14    >   ASSIGN                                                   !3, !0
         15      > JMP                                                      ->17
   24    16    >   ASSIGN                                                   !3, !1
   27    17    >   INIT_FCALL                                               'date'
         18        SEND_VAL                                                 'Y-m-d+H%3Ai'
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                         $13     
         21        ECHO                                                     $13
   28    22      > RETURN                                                   null

End of function validnextdrawdate

End of class dateCalculation.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.65 ms | 1400 KiB | 17 Q