3v4l.org

run code in 500+ PHP versions simultaneously
<?php class R { function isError(): bool { return true; } } class S { function doSomething($input): R { return new R; } } $input = "str"; $service = new S; $shouldStop = ($result = $service->doSomething($input)) && $result->isError(); var_dump($shouldStop);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/J4BWi
function name:  (null)
number of ops:  17
compiled vars:  !0 = $input, !1 = $service, !2 = $shouldStop, !3 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                       !0, 'str'
   15     1        NEW                                                  $5      'S'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $5
   16     4        INIT_METHOD_CALL                                             !1, 'doSomething'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0  $8      
          7        ASSIGN                                               ~9      !3, $8
          8      > JMPZ_EX                                              ~9      ~9, ->12
          9    >   INIT_METHOD_CALL                                             !3, 'isError'
         10        DO_FCALL                                          0  $10     
         11        BOOL                                                 ~9      $10
         12    >   ASSIGN                                                       !2, ~9
   17    13        INIT_FCALL                                                   'var_dump'
         14        SEND_VAR                                                     !2
         15        DO_ICALL                                                     
         16      > RETURN                                                       1

Class R:
Function iserror:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J4BWi
function name:  isError
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                       <true>
    6     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function iserror

End of class R.

Class S:
Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/J4BWi
function name:  doSomething
number of ops:  7
compiled vars:  !0 = $input
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   10     1        NEW                                                  $1      'R'
          2        DO_FCALL                                          0          
          3        VERIFY_RETURN_TYPE                                           $1
          4      > RETURN                                                       $1
   11     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function dosomething

End of class S.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.79 ms | 1453 KiB | 14 Q