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

End of function __construct

Function nextvaliddrawdate:
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/Q9Hvu
function name:  nextValidDrawDate
number of ops:  23
compiled vars:  !0 = $next_valid_date_time_1, !1 = $next_valid_date_time_2, !2 = $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                                         $3      
          3        ASSIGN                                                   !0, $3
   18     4        INIT_FCALL                                               'strtotime'
          5        SEND_VAL                                                 'this+saturday+20%3A00'
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
   20     8        INIT_FCALL                                               'strtotime'
          9        FETCH_OBJ_R                                      ~7      'use_date'
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                         $8      
         12        IS_SMALLER                                               !0, $8
         13      > JMPZ                                                     ~9, ->16
   22    14    >   ASSIGN                                                   !2, !0
         15      > JMP                                                      ->17
   24    16    >   ASSIGN                                                   !2, !1
   27    17    >   INIT_FCALL                                               'date'
         18        SEND_VAL                                                 'Y-m-d+H%3Ai'
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $12     
         21        ECHO                                                     $12
   28    22      > RETURN                                                   null

End of function nextvaliddrawdate

End of class dateCalculation.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.63 ms | 1400 KiB | 17 Q