3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function returnBool() { return random_int(0,1) > 0; } } function returnsBool(?Foo $foo): bool { return $foo?->returnBool(); } var_dump(returnsBool(null));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mS4VP
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_FCALL                                                   'returnsbool'
          2        SEND_VAL                                                     null
          3        DO_FCALL                                          0  $0      
          4        SEND_VAR                                                     $0
          5        DO_ICALL                                                     
          6      > RETURN                                                       1

Function returnsbool:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mS4VP
function name:  returnsBool
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     1        JMP_NULL                                             $1      !0
          2        INIT_METHOD_CALL                                             !0, 'returnBool'
          3        DO_FCALL                                          0  $1      
          4        VERIFY_RETURN_TYPE                                           $1
          5      > RETURN                                                       $1
   11     6*       VERIFY_RETURN_TYPE                                           
          7*     > RETURN                                                       null

End of function returnsbool

Class Foo:
Function returnbool:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mS4VP
function name:  returnBool
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                                   'random_int'
          1        SEND_VAL                                                     0
          2        SEND_VAL                                                     1
          3        DO_ICALL                                             $0      
          4        IS_SMALLER                                           ~1      0, $0
          5      > RETURN                                                       ~1
    6     6*     > RETURN                                                       null

End of function returnbool

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
142.11 ms | 1301 KiB | 15 Q