3v4l.org

run code in 300+ PHP versions simultaneously
<?php class JobTimer{ public function __construct() { } public function isDateTime($startOn, $timezone = "GMT"){ $nowTime = new \DateTime("NOW", new \DateTimeZone($timezone)); $startTime = \DateTime::createFromFormat('Y-m-d H:iA', $startOn, new \DateTimeZone($timezone)); return $nowTime >= $startTime; } } $job = new JobTimer(); //if($job->isDateTime("2019-05-02 12:00AM", "Asia/Kuala_Lumpur")){ //if($job->isDateTime("2021-05-02 12:00AM", "Asia/Kuala_Lumpur")){ if($job->isDateTime("2020-05-02 12:00AM", "Asia/Kuala_Lumpur")){ echo "YES"; }else{ echo "NO"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGGNv
function name:  (null)
number of ops:  12
compiled vars:  !0 = $job
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'JobTimer'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   18     3        INIT_METHOD_CALL                                         !0, 'isDateTime'
          4        SEND_VAL_EX                                              '2020-05-02+12%3A00AM'
          5        SEND_VAL_EX                                              'Asia%2FKuala_Lumpur'
          6        DO_FCALL                                      0  $4      
          7      > JMPZ                                                     $4, ->10
   19     8    >   ECHO                                                     'YES'
   18     9      > JMP                                                      ->11
   21    10    >   ECHO                                                     'NO'
   22    11    > > RETURN                                                   1

Class JobTimer:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGGNv
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   null

End of function __construct

Function isdatetime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGGNv
function name:  isDateTime
number of ops:  22
compiled vars:  !0 = $startOn, !1 = $timezone, !2 = $nowTime, !3 = $startTime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'GMT'
    8     2        NEW                                              $4      'DateTime'
          3        SEND_VAL_EX                                              'NOW'
          4        NEW                                              $5      'DateTimeZone'
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $5
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $4
    9    10        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         11        SEND_VAL                                                 'Y-m-d+H%3AiA'
         12        SEND_VAR                                                 !0
         13        NEW                                              $9      'DateTimeZone'
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
         16        SEND_VAR                                                 $9
         17        DO_FCALL                                      0  $11     
         18        ASSIGN                                                   !3, $11
   10    19        IS_SMALLER_OR_EQUAL                              ~13     !3, !2
         20      > RETURN                                                   ~13
   11    21*     > RETURN                                                   null

End of function isdatetime

End of class JobTimer.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.92 ms | 1002 KiB | 13 Q