3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Nette; class DateTime extends \DateTime { /** minute in seconds */ const MINUTE = 60; /** hour in seconds */ const HOUR = 3600; /** day in seconds */ const DAY = 86400; /** week in seconds */ const WEEK = 604800; /** average month in seconds */ const MONTH = 2629800; /** average year in seconds */ const YEAR = 31557600; /** * DateTime object factory. * @param string|int|\DateTime * @return DateTime */ public static function from($time) { if ($time instanceof \DateTime || $time instanceof \DateTimeInterface) { return new static($time->format('Y-m-d H:i:s'), $time->getTimezone()); } elseif (is_numeric($time)) { if ($time <= self::YEAR) { $time += time(); } $d = new static; return $d->setTimestamp($time); } else { // textual or NULL return new static($time); } } public function __toString() { return $this->format('Y-m-d H:i:s'); } public function modifyClone($modify = '') { $dolly = clone $this; return $modify ? $dolly->modify($modify) : $dolly; } public function setTimestamp($timestamp) { $zone = $this->getTimezone(); $this->__construct('@' . $timestamp); return $this->setTimeZone($zone); } } var_dump((string) DateTime::from(2544000000));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/49dsV
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'nette%5Cdatetime', 'datetime'
   72     1        INIT_NS_FCALL_BY_NAME                                    'Nette%5Cvar_dump'
          2        INIT_STATIC_METHOD_CALL                                  'Nette%5CDateTime', 'from'
          3        SEND_VAL_EX                                              2544000000
          4        DO_FCALL                                      0  $0      
          5        CAST                                          6  ~1      $0
          6        SEND_VAL_EX                                              ~1
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class Nette\DateTime:
Function from:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 17
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 35
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/49dsV
function name:  from
number of ops:  40
compiled vars:  !0 = $time, !1 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   33     1        INSTANCEOF                                       ~2      !0, 'DateTime'
          2      > JMPNZ_EX                                         ~2      ~2, ->5
          3    >   INSTANCEOF                                       ~3      !0, 'DateTimeInterface'
          4        BOOL                                             ~2      ~3
          5    > > JMPZ                                                     ~2, ->17
   34     6    >   NEW                          static              $4      
          7        INIT_METHOD_CALL                                         !0, 'format'
          8        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3As'
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR_NO_REF_EX                                       $5
         11        INIT_METHOD_CALL                                         !0, 'getTimezone'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR_NO_REF_EX                                       $6
         14        DO_FCALL                                      0          
         15      > RETURN                                                   $4
         16*       JMP                                                      ->39
   36    17    >   INIT_NS_FCALL_BY_NAME                                    'Nette%5Cis_numeric'
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0  $8      
         20      > JMPZ                                                     $8, ->35
   37    21    >   FETCH_CLASS_CONSTANT                             ~9      'YEAR'
         22        IS_SMALLER_OR_EQUAL                                      !0, ~9
         23      > JMPZ                                                     ~10, ->27
   38    24    >   INIT_NS_FCALL_BY_NAME                                    'Nette%5Ctime'
         25        DO_FCALL                                      0  $11     
         26        ASSIGN_OP                                     1          !0, $11
   40    27    >   NEW                          static              $13     
         28        DO_FCALL                                      0          
         29        ASSIGN                                                   !1, $13
   41    30        INIT_METHOD_CALL                                         !1, 'setTimestamp'
         31        SEND_VAR_EX                                              !0
         32        DO_FCALL                                      0  $16     
         33      > RETURN                                                   $16
         34*       JMP                                                      ->39
   44    35    >   NEW                          static              $17     
         36        SEND_VAR_EX                                              !0
         37        DO_FCALL                                      0          
         38      > RETURN                                                   $17
   46    39*     > RETURN                                                   null

End of function from

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/49dsV
function name:  __toString
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   INIT_METHOD_CALL                                         'format'
          1        SEND_VAL_EX                                              'Y-m-d+H%3Ai%3As'
          2        DO_FCALL                                      0  $0      
          3        VERIFY_RETURN_TYPE                                       $0
          4      > RETURN                                                   $0
   52     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function __tostring

Function modifyclone:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
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/49dsV
function name:  modifyClone
number of ops:  13
compiled vars:  !0 = $modify, !1 = $dolly
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV_INIT                                        !0      ''
   57     1        FETCH_THIS                                       ~2      
          2        CLONE                                            ~3      ~2
          3        ASSIGN                                                   !1, ~3
   58     4      > JMPZ                                                     !0, ->10
          5    >   INIT_METHOD_CALL                                         !1, 'modify'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $5      
          8        QM_ASSIGN                                        ~6      $5
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~6      !1
         11    > > RETURN                                                   ~6
   59    12*     > RETURN                                                   null

End of function modifyclone

Function settimestamp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/49dsV
function name:  setTimestamp
number of ops:  13
compiled vars:  !0 = $timestamp, !1 = $zone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   RECV                                             !0      
   64     1        INIT_METHOD_CALL                                         'getTimezone'
          2        DO_FCALL                                      0  $2      
          3        ASSIGN                                                   !1, $2
   65     4        INIT_METHOD_CALL                                         '__construct'
          5        CONCAT                                           ~4      '%40', !0
          6        SEND_VAL_EX                                              ~4
          7        DO_FCALL                                      0          
   66     8        INIT_METHOD_CALL                                         'setTimeZone'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $6      
         11      > RETURN                                                   $6
   67    12*     > RETURN                                                   null

End of function settimestamp

End of class Nette\DateTime.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.98 ms | 1404 KiB | 19 Q