3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('America/New_York'); $date = new DateTime(); echo json_encode($date,JSON_FORCE_OBJECT); var_dump(json_last_error(), json_last_error_msg()); function check($name) { $o = new $name('now', new DateTimeZone('UTC')); echo json_encode($o); $s = serialize($o); var_dump(isset($o2->_date_time) === false); } check('DateTime'); class A extends DateTime {} check('A');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dXfFL
function name:  (null)
number of ops:  26
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'America%2FNew_York'
          2        DO_ICALL                                                 
    5     3        NEW                                              $2      'DateTime'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
    7     6        INIT_FCALL                                               'json_encode'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 16
          9        DO_ICALL                                         $5      
         10        ECHO                                                     $5
    8    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'json_last_error'
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        INIT_FCALL                                               'json_last_error_msg'
         16        DO_ICALL                                         $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                                 
   17    19        INIT_FCALL                                               'check'
         20        SEND_VAL                                                 'DateTime'
         21        DO_FCALL                                      0          
   20    22        INIT_FCALL                                               'check'
         23        SEND_VAL                                                 'A'
         24        DO_FCALL                                      0          
         25      > RETURN                                                   1

Function check:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dXfFL
function name:  check
number of ops:  24
compiled vars:  !0 = $name, !1 = $o, !2 = $s, !3 = $o2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        FETCH_CLASS                                   0  $4      !0
          2        NEW                                              $5      $4
          3        SEND_VAL_EX                                              'now'
          4        NEW                                              $6      'DateTimeZone'
          5        SEND_VAL_EX                                              'UTC'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $6
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $5
   12    10        INIT_FCALL                                               'json_encode'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $10     
         13        ECHO                                                     $10
   13    14        INIT_FCALL                                               'serialize'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !2, $11
   15    18        INIT_FCALL                                               'var_dump'
         19        ISSET_ISEMPTY_PROP_OBJ                           ~13     !3, '_date_time'
         20        TYPE_CHECK                                    4  ~14     ~13
         21        SEND_VAL                                                 ~14
         22        DO_ICALL                                                 
   16    23      > RETURN                                                   null

End of function check

Class A: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.81 ms | 1403 KiB | 27 Q