3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); class One { public function test() :?DateTimeImmutable { return rand(0,1) === 1 ? new DateTimeImmutable(): null; } } class Two { public function test(): void { $test = new One(); echo $test->test() ? $test->test()->format('d') : null; } } $two = new Two(); $two->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jNRDj
function name:  (null)
number of ops:  6
compiled vars:  !0 = $two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Two'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class One:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jNRDj
function name:  test
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'rand'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1
          3        DO_ICALL                                         $0      
          4        IS_IDENTICAL                                             $0, 1
          5      > JMPZ                                                     ~1, ->10
          6    >   NEW                                              $2      'DateTimeImmutable'
          7        DO_FCALL                                      0          
          8        QM_ASSIGN                                        ~4      $2
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~4      null
         11    >   VERIFY_RETURN_TYPE                                       ~4
         12      > RETURN                                                   ~4
    8    13*       VERIFY_RETURN_TYPE                                       
         14*     > RETURN                                                   null

End of function test

End of class One.

Class Two:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jNRDj
function name:  test
number of ops:  16
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'One'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   16     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0  $4      
          5      > JMPZ                                                     $4, ->13
   17     6    >   INIT_METHOD_CALL                                         !0, 'test'
          7        DO_FCALL                                      0  $5      
          8        INIT_METHOD_CALL                                         $5, 'format'
          9        SEND_VAL_EX                                              'd'
         10        DO_FCALL                                      0  $6      
         11        QM_ASSIGN                                        ~7      $6
         12      > JMP                                                      ->14
   18    13    >   QM_ASSIGN                                        ~7      null
         14    >   ECHO                                                     ~7
   19    15      > RETURN                                                   null

End of function test

End of class Two.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.11 ms | 1405 KiB | 15 Q