3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo() : A { return (date('s') % 2) ? new self : null; } } $a = new A; $a->foo(); echo 'a';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JcgGq
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   12     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
   13     5        ECHO                                                     'a'
          6      > RETURN                                                   1

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

End of function foo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.63 ms | 1395 KiB | 15 Q