3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait TimeTrait { public static function createFromTimestamp(int|float $timestamp, $timezone = null, ?string $locale = null) { $time = new self(gmdate('Y-m-d H:i:s', $timestamp), 'UTC', $locale); $timezone ??= date_default_timezone_get(); return $time->setTimezone($timezone); } } class Time extends DateTimeImmutable { use TimeTrait; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/INmps
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                            'time', 'datetimeimmutable'
   18     1      > RETURN                                                   1

Class TimeTrait:
Function createfromtimestamp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/INmps
function name:  createFromTimestamp
number of ops:  24
compiled vars:  !0 = $timestamp, !1 = $timezone, !2 = $locale, !3 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      null
    7     3        NEW                          self                $4      
          4        INIT_FCALL                                               'gmdate'
          5        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $5      
          8        SEND_VAR_NO_REF_EX                                       $5
          9        SEND_VAL_EX                                              'UTC'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !3, $4
    9    13        COALESCE                                         ~8      !1
         14        INIT_FCALL                                               'date_default_timezone_get'
         15        DO_ICALL                                         $9      
         16        ASSIGN                                           ~10     !1, $9
         17        QM_ASSIGN                                        ~8      ~10
         18        FREE                                                     ~8
   11    19        INIT_METHOD_CALL                                         !3, 'setTimezone'
         20        SEND_VAR_EX                                              !1
         21        DO_FCALL                                      0  $11     
         22      > RETURN                                                   $11
   12    23*     > RETURN                                                   null

End of function createfromtimestamp

End of class TimeTrait.

Class Time: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.91 ms | 1007 KiB | 15 Q