3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyDTI extends DateTimeImmutable { public $tag = 'immutable-tag'; private $secret = 'i-secret'; public function getSecret() { return $this->secret; } } $i = new MyDTI('2015-11-20 09:00:00'); $r = $i->add(new DateInterval('P1D')); echo get_class($r) . "|" . $r->format('Y-m-d') . "|" . (isset($r->tag)?$r->tag:'NONE') . "|" . ((method_exists($r,'getSecret'))?$r->getSecret():'NOSEC') . "\n"; $r2 = $i->setDate(2015,11,21); echo get_class($r2) . "|" . (isset($r2->tag)?$r2->tag:'NONE') . "\n"; class MyDT extends DateTime { public $tag='mt'; private $secret='ms'; public function getSecret(){return $this->secret;} } $m = new MyDT('2015-11-20 09:00:00'); $c = clone $m; $c->add(new DateInterval('P1D')); echo get_class($c) . "|" . $c->format('Y-m-d') . "|" . $c->tag . "|" . $c->getSecret() . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 35
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 52
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 52
Branch analysis from position: 49
Branch analysis from position: 52
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 35
Branch analysis from position: 31
Branch analysis from position: 35
filename:       /in/CcibH
function name:  (null)
number of ops:  84
compiled vars:  !0 = $i, !1 = $r, !2 = $r2, !3 = $m, !4 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   NEW                                                  $5      'MyDTI'
          1        SEND_VAL_EX                                                  '2015-11-20+09%3A00%3A00'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $5
    8     4        INIT_METHOD_CALL                                             !0, 'add'
          5        NEW                                                  $8      'DateInterval'
          6        SEND_VAL_EX                                                  'P1D'
          7        DO_FCALL                                          0          
          8        SEND_VAR_NO_REF_EX                                           $8
          9        DO_FCALL                                          0  $10     
         10        ASSIGN                                                       !1, $10
    9    11        GET_CLASS                                            ~12     !1
         12        CONCAT                                               ~13     ~12, '%7C'
         13        INIT_METHOD_CALL                                             !1, 'format'
         14        SEND_VAL_EX                                                  'Y-m-d'
         15        DO_FCALL                                          0  $14     
         16        CONCAT                                               ~15     ~13, $14
         17        CONCAT                                               ~16     ~15, '%7C'
         18        ISSET_ISEMPTY_PROP_OBJ                                       !1, 'tag'
         19      > JMPZ                                                         ~17, ->23
         20    >   FETCH_OBJ_R                                          ~18     !1, 'tag'
         21        QM_ASSIGN                                            ~19     ~18
         22      > JMP                                                          ->24
         23    >   QM_ASSIGN                                            ~19     'NONE'
         24    >   CONCAT                                               ~20     ~16, ~19
         25        CONCAT                                               ~21     ~20, '%7C'
         26        INIT_FCALL                                                   'method_exists'
         27        SEND_VAR                                                     !1
         28        SEND_VAL                                                     'getSecret'
         29        DO_ICALL                                             $22     
         30      > JMPZ                                                         $22, ->35
         31    >   INIT_METHOD_CALL                                             !1, 'getSecret'
         32        DO_FCALL                                          0  $23     
         33        QM_ASSIGN                                            ~24     $23
         34      > JMP                                                          ->36
         35    >   QM_ASSIGN                                            ~24     'NOSEC'
         36    >   CONCAT                                               ~25     ~21, ~24
         37        CONCAT                                               ~26     ~25, '%0A'
         38        ECHO                                                         ~26
   10    39        INIT_METHOD_CALL                                             !0, 'setDate'
         40        SEND_VAL_EX                                                  2015
         41        SEND_VAL_EX                                                  11
         42        SEND_VAL_EX                                                  21
         43        DO_FCALL                                          0  $27     
         44        ASSIGN                                                       !2, $27
   11    45        GET_CLASS                                            ~29     !2
         46        CONCAT                                               ~30     ~29, '%7C'
         47        ISSET_ISEMPTY_PROP_OBJ                                       !2, 'tag'
         48      > JMPZ                                                         ~31, ->52
         49    >   FETCH_OBJ_R                                          ~32     !2, 'tag'
         50        QM_ASSIGN                                            ~33     ~32
         51      > JMP                                                          ->53
         52    >   QM_ASSIGN                                            ~33     'NONE'
         53    >   CONCAT                                               ~34     ~30, ~33
         54        CONCAT                                               ~35     ~34, '%0A'
         55        ECHO                                                         ~35
   13    56        NEW                                                  $36     'MyDT'
         57        SEND_VAL_EX                                                  '2015-11-20+09%3A00%3A00'
         58        DO_FCALL                                          0          
         59        ASSIGN                                                       !3, $36
         60        CLONE                                                ~39     !3
         61        ASSIGN                                                       !4, ~39
         62        INIT_METHOD_CALL                                             !4, 'add'
         63        NEW                                                  $41     'DateInterval'
         64        SEND_VAL_EX                                                  'P1D'
         65        DO_FCALL                                          0          
         66        SEND_VAR_NO_REF_EX                                           $41
         67        DO_FCALL                                          0          
   14    68        GET_CLASS                                            ~44     !4
         69        CONCAT                                               ~45     ~44, '%7C'
         70        INIT_METHOD_CALL                                             !4, 'format'
         71        SEND_VAL_EX                                                  'Y-m-d'
         72        DO_FCALL                                          0  $46     
         73        CONCAT                                               ~47     ~45, $46
         74        CONCAT                                               ~48     ~47, '%7C'
         75        FETCH_OBJ_R                                          ~49     !4, 'tag'
         76        CONCAT                                               ~50     ~48, ~49
         77        CONCAT                                               ~51     ~50, '%7C'
         78        INIT_METHOD_CALL                                             !4, 'getSecret'
         79        DO_FCALL                                          0  $52     
         80        CONCAT                                               ~53     ~51, $52
         81        CONCAT                                               ~54     ~53, '%0A'
         82        ECHO                                                         ~54
         83      > RETURN                                                       1

Class MyDTI:
Function getsecret:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CcibH
function name:  getSecret
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   FETCH_OBJ_R                                          ~0      'secret'
          1      > RETURN                                                       ~0
          2*     > RETURN                                                       null

End of function getsecret

End of class MyDTI.

Class MyDT:
Function getsecret:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CcibH
function name:  getSecret
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   FETCH_OBJ_R                                          ~0      'secret'
          1      > RETURN                                                       ~0
          2*     > RETURN                                                       null

End of function getsecret

End of class MyDT.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
123 ms | 495 KiB | 10 Q