3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Zend\Stdlib { use DateTimeZone; class DateTime extends \DateTime { public function __construct($time = 'now', $timezone = null) { // workaround not required for PHP 5.3.7 or newer if(version_compare(PHP_VERSION, '5.3.7','>=')){ return parent::__construct($time, $timezone); } // Check if using relative constructs if(!stristr($time, 'last') && !stristr($time, 'first')){ return parent::__construct($time, $timezone); } // Use current time with constructor to prevent setting 'first_last_day_of' flag parent::__construct('now', $timezone); // Set the timestamp by relying on strtotime and avoiding setting the // internal 'first_last_day_of' flag of DateTime object. $this->setTimestamp( strtotime($time, $this->getTimestamp()) ); return $this; } public function modify($modify) { // Workaround not required for PHP 5.3.7 or newer if(version_compare(PHP_VERSION, '5.3.7','>=')){ return parent::modify($modify); } // Check if using relative constructs if(!stristr($modify, 'last') && !stristr($modify, 'first')){ return parent::modify($modify); } // Set the timestamp by relying on strtotime and avoiding setting the // internal 'first_last_day_of' flag of DateTime object. $parsedTimestamp = strtotime($modify, $this->getTimestamp()); if ($parsedTimestamp === false) { return false; // something went wrong parsing the date } $this->setTimestamp($parsedTimestamp); return $this; } } $interval = new \DateInterval('P1D'); $dt = new \DateTime('first day of feb 2010'); var_dump($dt); $dt->add($interval); var_dump($dt); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5ZJV6
function name:  (null)
number of ops:  18
compiled vars:  !0 = $interval, !1 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   56     0  E >   NEW                                              $2      'DateInterval'
          1        SEND_VAL_EX                                              'P1D'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   57     4        NEW                                              $5      'DateTime'
          5        SEND_VAL_EX                                              'first+day+of+feb+2010'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   58     8        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cvar_dump'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
   59    11        INIT_METHOD_CALL                                         !1, 'add'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
   60    14        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cvar_dump'
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
   63    17      > RETURN                                                   1

Class Zend\Stdlib\DateTime:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 26
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/5ZJV6
function name:  __construct
number of ops:  48
compiled vars:  !0 = $time, !1 = $timezone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                        !0      'now'
          1        RECV_INIT                                        !1      null
   11     2        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cversion_compare'
          3        FETCH_CONSTANT                                   ~2      'Zend%5CStdlib%5CPHP_VERSION'
          4        SEND_VAL_EX                                              ~2
          5        SEND_VAL_EX                                              '5.3.7'
          6        SEND_VAL_EX                                              '%3E%3D'
          7        DO_FCALL                                      0  $3      
          8      > JMPZ                                                     $3, ->14
   12     9    >   INIT_STATIC_METHOD_CALL                                  
         10        SEND_VAR_EX                                              !0
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $4      
         13      > RETURN                                                   $4
   16    14    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstristr'
         15        SEND_VAR_EX                                              !0
         16        SEND_VAL_EX                                              'last'
         17        DO_FCALL                                      0  $5      
         18        BOOL_NOT                                         ~6      $5
         19      > JMPZ_EX                                          ~6      ~6, ->26
         20    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstristr'
         21        SEND_VAR_EX                                              !0
         22        SEND_VAL_EX                                              'first'
         23        DO_FCALL                                      0  $7      
         24        BOOL_NOT                                         ~8      $7
         25        BOOL                                             ~6      ~8
         26    > > JMPZ                                                     ~6, ->32
   17    27    >   INIT_STATIC_METHOD_CALL                                  
         28        SEND_VAR_EX                                              !0
         29        SEND_VAR_EX                                              !1
         30        DO_FCALL                                      0  $9      
         31      > RETURN                                                   $9
   21    32    >   INIT_STATIC_METHOD_CALL                                  
         33        SEND_VAL_EX                                              'now'
         34        SEND_VAR_EX                                              !1
         35        DO_FCALL                                      0          
   25    36        INIT_METHOD_CALL                                         'setTimestamp'
   26    37        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstrtotime'
         38        SEND_VAR_EX                                              !0
         39        INIT_METHOD_CALL                                         'getTimestamp'
         40        DO_FCALL                                      0  $11     
         41        SEND_VAR_NO_REF_EX                                       $11
         42        DO_FCALL                                      0  $12     
         43        SEND_VAR_NO_REF_EX                                       $12
         44        DO_FCALL                                      0          
   29    45        FETCH_THIS                                       ~14     
         46      > RETURN                                                   ~14
   30    47*     > RETURN                                                   null

End of function __construct

Function modify:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 39
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/5ZJV6
function name:  modify
number of ops:  45
compiled vars:  !0 = $modify, !1 = $parsedTimestamp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   34     1        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cversion_compare'
          2        FETCH_CONSTANT                                   ~2      'Zend%5CStdlib%5CPHP_VERSION'
          3        SEND_VAL_EX                                              ~2
          4        SEND_VAL_EX                                              '5.3.7'
          5        SEND_VAL_EX                                              '%3E%3D'
          6        DO_FCALL                                      0  $3      
          7      > JMPZ                                                     $3, ->12
   35     8    >   INIT_STATIC_METHOD_CALL                                  'modify'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $4      
         11      > RETURN                                                   $4
   39    12    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstristr'
         13        SEND_VAR_EX                                              !0
         14        SEND_VAL_EX                                              'last'
         15        DO_FCALL                                      0  $5      
         16        BOOL_NOT                                         ~6      $5
         17      > JMPZ_EX                                          ~6      ~6, ->24
         18    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstristr'
         19        SEND_VAR_EX                                              !0
         20        SEND_VAL_EX                                              'first'
         21        DO_FCALL                                      0  $7      
         22        BOOL_NOT                                         ~8      $7
         23        BOOL                                             ~6      ~8
         24    > > JMPZ                                                     ~6, ->29
   40    25    >   INIT_STATIC_METHOD_CALL                                  'modify'
         26        SEND_VAR_EX                                              !0
         27        DO_FCALL                                      0  $9      
         28      > RETURN                                                   $9
   45    29    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstrtotime'
         30        SEND_VAR_EX                                              !0
         31        INIT_METHOD_CALL                                         'getTimestamp'
         32        DO_FCALL                                      0  $10     
         33        SEND_VAR_NO_REF_EX                                       $10
         34        DO_FCALL                                      0  $11     
         35        ASSIGN                                                   !1, $11
   46    36        TYPE_CHECK                                    4          !1
         37      > JMPZ                                                     ~13, ->39
   47    38    > > RETURN                                                   <false>
   49    39    >   INIT_METHOD_CALL                                         'setTimestamp'
         40        SEND_VAR_EX                                              !1
         41        DO_FCALL                                      0          
   51    42        FETCH_THIS                                       ~15     
         43      > RETURN                                                   ~15
   52    44*     > RETURN                                                   null

End of function modify

End of class Zend\Stdlib\DateTime.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.85 ms | 949 KiB | 22 Q