3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Zend\Stdlib { use DateTimeZone; class DateTime extends \DateTime { public function __construct($time = 'now', \DateTimeZone $timezone = null) { // workaround not required for PHP 5.3.7 or newer if(version_compare(PHP_VERSION, '5.3.7','>=')){ if($timezone) { return parent::__construct($time, $timezone); } else { return parent::__construct($time); } } // Check if using relative constructs if(!stristr($time, 'last') && !stristr($time, 'first')){ if($timezone) { return parent::__construct($time, $timezone); } else { return parent::__construct($time); } } // 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/5B6qG
function name:  (null)
number of ops:  18
compiled vars:  !0 = $interval, !1 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   66     0  E >   NEW                                              $2      'DateInterval'
          1        SEND_VAL_EX                                              'P1D'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   67     4        NEW                                              $5      'Zend%5CStdlib%5CDateTime'
          5        SEND_VAL_EX                                              'first+day+of+feb+2010'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   68     8        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cvar_dump'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
   69    11        INIT_METHOD_CALL                                         !1, 'add'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
   70    14        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cvar_dump'
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
   73    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 = 20
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 44
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 40
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/5B6qG
function name:  __construct
number of ops:  60
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, ->20
   12     9    > > JMPZ                                                     !1, ->16
   13    10    >   INIT_STATIC_METHOD_CALL                                  
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $4      
         14      > RETURN                                                   $4
         15*       JMP                                                      ->20
   15    16    >   INIT_STATIC_METHOD_CALL                                  
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $5      
         19      > RETURN                                                   $5
   21    20    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstristr'
         21        SEND_VAR_EX                                              !0
         22        SEND_VAL_EX                                              'last'
         23        DO_FCALL                                      0  $6      
         24        BOOL_NOT                                         ~7      $6
         25      > JMPZ_EX                                          ~7      ~7, ->32
         26    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstristr'
         27        SEND_VAR_EX                                              !0
         28        SEND_VAL_EX                                              'first'
         29        DO_FCALL                                      0  $8      
         30        BOOL_NOT                                         ~9      $8
         31        BOOL                                             ~7      ~9
         32    > > JMPZ                                                     ~7, ->44
   22    33    > > JMPZ                                                     !1, ->40
   23    34    >   INIT_STATIC_METHOD_CALL                                  
         35        SEND_VAR_EX                                              !0
         36        SEND_VAR_EX                                              !1
         37        DO_FCALL                                      0  $10     
         38      > RETURN                                                   $10
         39*       JMP                                                      ->44
   25    40    >   INIT_STATIC_METHOD_CALL                                  
         41        SEND_VAR_EX                                              !0
         42        DO_FCALL                                      0  $11     
         43      > RETURN                                                   $11
   31    44    >   INIT_STATIC_METHOD_CALL                                  
         45        SEND_VAL_EX                                              'now'
         46        SEND_VAR_EX                                              !1
         47        DO_FCALL                                      0          
   35    48        INIT_METHOD_CALL                                         'setTimestamp'
   36    49        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cstrtotime'
         50        SEND_VAR_EX                                              !0
         51        INIT_METHOD_CALL                                         'getTimestamp'
         52        DO_FCALL                                      0  $13     
         53        SEND_VAR_NO_REF_EX                                       $13
         54        DO_FCALL                                      0  $14     
         55        SEND_VAR_NO_REF_EX                                       $14
         56        DO_FCALL                                      0          
   39    57        FETCH_THIS                                       ~16     
         58      > RETURN                                                   ~16
   40    59*     > 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/5B6qG
function name:  modify
number of ops:  45
compiled vars:  !0 = $modify, !1 = $parsedTimestamp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
   44     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
   45     8    >   INIT_STATIC_METHOD_CALL                                  'modify'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0  $4      
         11      > RETURN                                                   $4
   49    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
   50    25    >   INIT_STATIC_METHOD_CALL                                  'modify'
         26        SEND_VAR_EX                                              !0
         27        DO_FCALL                                      0  $9      
         28      > RETURN                                                   $9
   55    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
   56    36        TYPE_CHECK                                    4          !1
         37      > JMPZ                                                     ~13, ->39
   57    38    > > RETURN                                                   <false>
   59    39    >   INIT_METHOD_CALL                                         'setTimestamp'
         40        SEND_VAR_EX                                              !1
         41        DO_FCALL                                      0          
   61    42        FETCH_THIS                                       ~15     
         43      > RETURN                                                   ~15
   62    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.19 ms | 1408 KiB | 21 Q