3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('GMT'); function runTest($a) { print "Before: " . $a->getTimestamp() . "\n"; $b = $a->modify('+1 day'); print "Result after: " . $b->getTimestamp() . "\n"; print "Original after: " . $a->getTimestamp() . "\n"; } print "Immutable:\n"; runTest(new DateTimeImmutable('12/12/2012 12:12:12')); print "\n\nStandard:\n"; runTest(new DateTime('12/12/2012 12:12:12'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cPCQT
function name:  (null)
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'GMT'
          2        DO_ICALL                                                 
   13     3        ECHO                                                     'Immutable%3A%0A'
   14     4        INIT_FCALL                                               'runtest'
          5        NEW                                              $1      'DateTimeImmutable'
          6        SEND_VAL_EX                                              '12%2F12%2F2012+12%3A12%3A12'
          7        DO_FCALL                                      0          
          8        SEND_VAR                                                 $1
          9        DO_FCALL                                      0          
   15    10        ECHO                                                     '%0A%0AStandard%3A%0A'
   16    11        INIT_FCALL                                               'runtest'
         12        NEW                                              $4      'DateTime'
         13        SEND_VAL_EX                                              '12%2F12%2F2012+12%3A12%3A12'
         14        DO_FCALL                                      0          
         15        SEND_VAR                                                 $4
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Function runtest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cPCQT
function name:  runTest
number of ops:  21
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_METHOD_CALL                                         !0, 'getTimestamp'
          2        DO_FCALL                                      0  $2      
          3        CONCAT                                           ~3      'Before%3A+', $2
          4        CONCAT                                           ~4      ~3, '%0A'
          5        ECHO                                                     ~4
    8     6        INIT_METHOD_CALL                                         !0, 'modify'
          7        SEND_VAL_EX                                              '%2B1+day'
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !1, $5
    9    10        INIT_METHOD_CALL                                         !1, 'getTimestamp'
         11        DO_FCALL                                      0  $7      
         12        CONCAT                                           ~8      'Result+after%3A+', $7
         13        CONCAT                                           ~9      ~8, '%0A'
         14        ECHO                                                     ~9
   10    15        INIT_METHOD_CALL                                         !0, 'getTimestamp'
         16        DO_FCALL                                      0  $10     
         17        CONCAT                                           ~11     'Original+after%3A+', $10
         18        CONCAT                                           ~12     ~11, '%0A'
         19        ECHO                                                     ~12
   11    20      > RETURN                                                   null

End of function runtest

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.86 ms | 1403 KiB | 17 Q