3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Foo { public function out(string $msg) { print __CLASS__ . ': ' . $msg . PHP_EOL; } } class Msg { public function __toString() { return "world"; } } class Bar extends Foo { public function out($msg) { print __CLASS__ . ': ' . $msg . PHP_EOL; } } $f = new Foo(); try { $f->out('hello'); } catch (TypeError $e) { print $e->getMessage() . PHP_EOL; } try { $f->out(new Msg()); } catch (TypeError $e) { print $e->getMessage() . PHP_EOL; } $b = new Bar(); try { $b->out('hello'); } catch (TypeError $e) { print $e->getMessage() . PHP_EOL; } try { $b->out(new Msg()); } catch (TypeError $e) { print $e->getMessage() . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Found catch point at position: 19
Branch analysis from position: 19
2 jumps found. (Code = 107) Position 1 = 20, Position 2 = -2
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Found catch point at position: 31
Branch analysis from position: 31
2 jumps found. (Code = 107) Position 1 = 32, Position 2 = -2
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
Found catch point at position: 42
Branch analysis from position: 42
2 jumps found. (Code = 107) Position 1 = 43, Position 2 = -2
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0dpsJ
function name:  (null)
number of ops:  48
compiled vars:  !0 = $f, !1 = $e, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_CLASS                                            'msg'
   24     1        NEW                                              $3      'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   27     4        INIT_METHOD_CALL                                         !0, 'out'
          5        SEND_VAL_EX                                              'hello'
          6        DO_FCALL                                      0          
          7      > JMP                                                      ->13
   29     8  E > > CATCH                                       last         'TypeError'
   30     9    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         10        DO_FCALL                                      0  $7      
         11        CONCAT                                           ~8      $7, '%0A'
         12        ECHO                                                     ~8
   34    13    >   INIT_METHOD_CALL                                         !0, 'out'
         14        NEW                                              $9      'Msg'
         15        DO_FCALL                                      0          
         16        SEND_VAR_NO_REF_EX                                       $9
         17        DO_FCALL                                      0          
         18      > JMP                                                      ->24
   36    19  E > > CATCH                                       last         'TypeError'
   37    20    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         21        DO_FCALL                                      0  $12     
         22        CONCAT                                           ~13     $12, '%0A'
         23        ECHO                                                     ~13
   40    24    >   NEW                                              $14     'Bar'
         25        DO_FCALL                                      0          
         26        ASSIGN                                                   !2, $14
   43    27        INIT_METHOD_CALL                                         !2, 'out'
         28        SEND_VAL_EX                                              'hello'
         29        DO_FCALL                                      0          
         30      > JMP                                                      ->36
   45    31  E > > CATCH                                       last         'TypeError'
   46    32    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         33        DO_FCALL                                      0  $18     
         34        CONCAT                                           ~19     $18, '%0A'
         35        ECHO                                                     ~19
   50    36    >   INIT_METHOD_CALL                                         !2, 'out'
         37        NEW                                              $20     'Msg'
         38        DO_FCALL                                      0          
         39        SEND_VAR_NO_REF_EX                                       $20
         40        DO_FCALL                                      0          
         41      > JMP                                                      ->47
   52    42  E > > CATCH                                       last         'TypeError'
   53    43    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         44        DO_FCALL                                      0  $23     
         45        CONCAT                                           ~24     $23, '%0A'
         46        ECHO                                                     ~24
   54    47    > > RETURN                                                   1

Class Foo:
Function out:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0dpsJ
function name:  out
number of ops:  5
compiled vars:  !0 = $msg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        CONCAT                                           ~1      'Foo%3A+', !0
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
    9     4      > RETURN                                                   null

End of function out

End of class Foo.

Class Msg:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0dpsJ
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   'world'
   15     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class Msg.

Class Bar:
Function out:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0dpsJ
function name:  out
number of ops:  5
compiled vars:  !0 = $msg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   20     1        CONCAT                                           ~1      'Bar%3A+', !0
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
   21     4      > RETURN                                                   null

End of function out

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
249.49 ms | 1000 KiB | 13 Q