3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class R { function isError(): bool { return true; } } class S { function doSomething($input): R { return new R; } } function needBool(bool $b) { var_dump($b); } $input = "str"; $service = new S; $shouldStop = ($result = $service->doSomething($input)) && $result->isError(); needBool($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/dhnpc
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
-------------------------------------------------------------------------------------
   19     0  E >   ASSIGN                                                   !0, 'str'
   20     1        NEW                                              $5      'S'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   21     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
   22    13        INIT_FCALL                                               'needbool'
         14        SEND_VAR                                                 !2
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Function needbool:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dhnpc
function name:  needBool
number of ops:  5
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   17     4      > RETURN                                                   null

End of function needbool

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

End of function dosomething

End of class S.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.29 ms | 1009 KiB | 15 Q