3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); phpversion() >= "7.0.0" or die(); function myErrorHandler($errno, $errstr, $errfile, $errline) { if ( E_RECOVERABLE_ERROR===$errno ) { echo "'catched' catchable fatal error\n"; return true; } return false; } set_error_handler('myErrorHandler'); class FooBar { public $prop = '123'; } class BarFoo { public $prop = '312'; } function test () : FooBar { return new FooBar; } function test1 () : BarFoo { return new FooBar; } try { var_dump(test1()); } catch (Exception $e) { var_dump($e->getMessage()); } var_dump(test());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 15
Branch analysis from position: 15
2 jumps found. (Code = 107) Position 1 = 16, Position 2 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5eh2H
function name:  (null)
number of ops:  27
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'phpversion'
          1        DO_ICALL                                         $1      
          2        IS_SMALLER_OR_EQUAL                              ~2      '7.0.0', $1
          3      > JMPNZ_EX                                         ~2      ~2, ->6
          4    > > EXIT                                                     
          5*       BOOL                                             ~2      <true>
   13     6    >   INIT_FCALL                                               'set_error_handler'
          7        SEND_VAL                                                 'myErrorHandler'
          8        DO_ICALL                                                 
   32     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'test1'
         11        DO_FCALL                                      0  $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                                 
         14      > JMP                                                      ->21
   33    15  E > > CATCH                                       last         'Exception'
   34    16    >   INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'getMessage'
         18        DO_FCALL                                      0  $6      
         19        SEND_VAR                                                 $6
         20        DO_ICALL                                                 
   37    21    >   INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'test'
         23        DO_FCALL                                      0  $8      
         24        SEND_VAR                                                 $8
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Function myerrorhandler:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5eh2H
function name:  myErrorHandler
number of ops:  10
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
    7     4        IS_IDENTICAL                                             !0, 4096
          5      > JMPZ                                                     ~4, ->8
    8     6    >   ECHO                                                     '%27catched%27+catchable+fatal+error%0A'
    9     7      > RETURN                                                   <true>
   11     8    > > RETURN                                                   <false>
   12     9*     > RETURN                                                   null

End of function myerrorhandler

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5eh2H
function name:  test
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $0      'FooBar'
          1        DO_FCALL                                      0          
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   25     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function test

Function test1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5eh2H
function name:  test1
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $0      'FooBar'
          1        DO_FCALL                                      0          
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   29     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function test1

Class FooBar: [no user functions]
Class BarFoo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.63 ms | 1403 KiB | 22 Q