3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php if (!class_exists('DateTime') ) { die('Feature not available yet'); } echo "mine:\n"; $a = date_create("2016-04-30", new DateTimeZone("UTC")); $b = date_create("now"); var_dump($a, $b, $a<$b, $a==$b, $a>$b); echo "\n"; echo "Same date:\n"; $a = new DateTime('2015-01-31 01:23:45 UTC'); $b = new DateTime('2015-01-31 02:23:45 Europe/Paris'); var_dump($a, $b, $a<$b, $a==$b, $a>$b); echo "\n"; echo "First greater than second:\n"; $a = new DateTime('2015-01-31 01:23:46 UTC'); $b = new DateTime('2015-01-31 02:23:45 Europe/Paris'); var_dump($a, $b, $a<$b, $a==$b, $a>$b); echo "\n"; echo "First less than second:\n"; $a = new DateTime('2015-01-31 01:23:45 UTC'); $b = new DateTime('2015-01-31 02:23:46 Europe/Paris'); var_dump($a, $b, $a<$b, $a==$b, $a>$b);
based on kEB2m
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
Jump found. Position 1 = -2
Branch analysis from position: 6
Jump found. Position 1 = -2
filename:       /in/Bfc59
function name:  (null)
number of ops:  90
compiled vars:  !0 = $a, !1 = $b
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   INIT_FCALL                                               'class_exists'
         1        SEND_VAL                                                 'DateTime'
         2        DO_ICALL                                         $2      
         3        BOOL_NOT                                         ~3      $2
         4      > JMPZ                                                     ~3, ->6
   4     5    > > EXIT                                                     'Feature+not+available+yet'
   7     6    >   ECHO                                                     'mine%3A%0A'
   8     7        INIT_FCALL                                               'date_create'
         8        SEND_VAL                                                 '2016-04-30'
         9        NEW                                              $4      :0
        10        SEND_VAL_EX                                              'UTC'
        11        DO_FCALL                                      0          
        12        SEND_VAR                                                 $4
        13        DO_ICALL                                         $6      
        14        ASSIGN                                                   !0, $6
   9    15        INIT_FCALL                                               'date_create'
        16        SEND_VAL                                                 'now'
        17        DO_ICALL                                         $8      
        18        ASSIGN                                                   !1, $8
  10    19        INIT_FCALL                                               'var_dump'
        20        SEND_VAR                                                 !0
        21        SEND_VAR                                                 !1
        22        IS_SMALLER                                       ~10     !0, !1
        23        SEND_VAL                                                 ~10
        24        IS_EQUAL                                         ~11     !0, !1
        25        SEND_VAL                                                 ~11
        26        IS_SMALLER                                       ~12     !1, !0
        27        SEND_VAL                                                 ~12
        28        DO_ICALL                                                 
  11    29        ECHO                                                     '%0A'
  13    30        ECHO                                                     'Same+date%3A%0A'
  14    31        NEW                                              $14     :8
        32        SEND_VAL_EX                                              '2015-01-31+01%3A23%3A45+UTC'
        33        DO_FCALL                                      0          
        34        ASSIGN                                                   !0, $14
  15    35        NEW                                              $17     :11
        36        SEND_VAL_EX                                              '2015-01-31+02%3A23%3A45+Europe%2FParis'
        37        DO_FCALL                                      0          
        38        ASSIGN                                                   !1, $17
  16    39        INIT_FCALL                                               'var_dump'
        40        SEND_VAR                                                 !0
        41        SEND_VAR                                                 !1
        42        IS_SMALLER                                       ~20     !0, !1
        43        SEND_VAL                                                 ~20
        44        IS_EQUAL                                         ~21     !0, !1
        45        SEND_VAL                                                 ~21
        46        IS_SMALLER                                       ~22     !1, !0
        47        SEND_VAL                                                 ~22
        48        DO_ICALL                                                 
  17    49        ECHO                                                     '%0A'
  19    50        ECHO                                                     'First+greater+than+second%3A%0A'
  20    51        NEW                                              $24     :17
        52        SEND_VAL_EX                                              '2015-01-31+01%3A23%3A46+UTC'
        53        DO_FCALL                                      0          
        54        ASSIGN                                                   !0, $24
  21    55        NEW                                              $27     :20
        56        SEND_VAL_EX                                              '2015-01-31+02%3A23%3A45+Europe%2FParis'
        57        DO_FCALL                                      0          
        58        ASSIGN                                                   !1, $27
  22    59        INIT_FCALL                                               'var_dump'
        60        SEND_VAR                                                 !0
        61        SEND_VAR                                                 !1
        62        IS_SMALLER                                       ~30     !0, !1
        63        SEND_VAL                                                 ~30
        64        IS_EQUAL                                         ~31     !0, !1
        65        SEND_VAL                                                 ~31
        66        IS_SMALLER                                       ~32     !1, !0
        67        SEND_VAL                                                 ~32
        68        DO_ICALL                                                 
  23    69        ECHO                                                     '%0A'
  25    70        ECHO                                                     'First+less+than+second%3A%0A'
  26    71        NEW                                              $34     :26
        72        SEND_VAL_EX                                              '2015-01-31+01%3A23%3A45+UTC'
        73        DO_FCALL                                      0          
        74        ASSIGN                                                   !0, $34
  27    75        NEW                                              $37     :29
        76        SEND_VAL_EX                                              '2015-01-31+02%3A23%3A46+Europe%2FParis'
        77        DO_FCALL                                      0          
        78        ASSIGN                                                   !1, $37
  28    79        INIT_FCALL                                               'var_dump'
        80        SEND_VAR                                                 !0
        81        SEND_VAR                                                 !1
        82        IS_SMALLER                                       ~40     !0, !1
        83        SEND_VAL                                                 ~40
        84        IS_EQUAL                                         ~41     !0, !1
        85        SEND_VAL                                                 ~41
        86        IS_SMALLER                                       ~42     !1, !0
        87        SEND_VAL                                                 ~42
        88        DO_ICALL                                                 
        89      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0