3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyDateTimeImmutableMidnightUTC extends \DateTimeImmutable { public function __construct(string $datetime) { parent::__construct($datetime, new \DateTimeZone('UTC')); $time = $this->format('H:i:s'); if ($time !== '00:00:00') { throw new RuntimeException("Midnight UTC datetime called with a non-midnight time! datetime: $datetime time: $time"); } } } new MyDateTimeImmutableMidnightUTC('2000-01-01 00:00'); new MyDateTimeImmutableMidnightUTC('2000-01-01 00:10');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UdMcb
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   NEW                                                  $0      'MyDateTimeImmutableMidnightUTC'
          1        SEND_VAL_EX                                                  '2000-01-01+00%3A00'
          2        DO_FCALL                                          0          
          3        FREE                                                         $0
   14     4        NEW                                                  $2      'MyDateTimeImmutableMidnightUTC'
          5        SEND_VAL_EX                                                  '2000-01-01+00%3A10'
          6        DO_FCALL                                          0          
          7        FREE                                                         $2
          8      > RETURN                                                       1

Class MyDateTimeImmutableMidnightUTC:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 22
Branch analysis from position: 14
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UdMcb
function name:  __construct
number of ops:  23
compiled vars:  !0 = $datetime, !1 = $time
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
    5     1        INIT_STATIC_METHOD_CALL                                      
          2        SEND_VAR_EX                                                  !0
          3        NEW                                                  $2      'DateTimeZone'
          4        SEND_VAL_EX                                                  'UTC'
          5        DO_FCALL                                          0          
          6        SEND_VAR_NO_REF_EX                                           $2
          7        DO_FCALL                                          0          
    6     8        INIT_METHOD_CALL                                             'format'
          9        SEND_VAL_EX                                                  'H%3Ai%3As'
         10        DO_FCALL                                          0  $5      
         11        ASSIGN                                                       !1, $5
    7    12        IS_NOT_IDENTICAL                                             !1, '00%3A00%3A00'
         13      > JMPZ                                                         ~7, ->22
    8    14    >   NEW                                                  $8      'RuntimeException'
         15        ROPE_INIT                                         4  ~10     'Midnight+UTC+datetime+called+with+a+non-midnight+time%21+datetime%3A+'
         16        ROPE_ADD                                          1  ~10     ~10, !0
         17        ROPE_ADD                                          2  ~10     ~10, '+time%3A+'
         18        ROPE_END                                          3  ~9      ~10, !1
         19        SEND_VAL_EX                                                  ~9
         20        DO_FCALL                                          0          
         21      > THROW                                             0          $8
   10    22    > > RETURN                                                       null

End of function __construct

End of class MyDateTimeImmutableMidnightUTC.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
208.84 ms | 1930 KiB | 13 Q