3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { private $name = "Meow"; public function __toString() { throw new Exception('Op gei lalalei'); return $this->name; } } $test = new A(); try { $test->__toString(); } catch(Exception $e) { echo "Exception caught\n"; } try { echo $test; } catch(Exception $e) { echo "Exception caught\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 7
Branch analysis from position: 7
2 jumps found. (Code = 107) Position 1 = 8, Position 2 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Found catch point at position: 11
Branch analysis from position: 11
2 jumps found. (Code = 107) Position 1 = 12, Position 2 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oYWvI
function name:  (null)
number of ops:  14
compiled vars:  !0 = $test, !1 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'a'
   14     1        NEW                                                  $2      'A'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   19     4        INIT_METHOD_CALL                                             !0, '__toString'
          5        DO_FCALL                                          0          
          6      > JMP                                                          ->9
   21     7  E > > CATCH                                           last         'Exception'
   23     8    >   ECHO                                                         'Exception+caught%0A'
   28     9    >   ECHO                                                         !0
         10      > JMP                                                          ->13
   30    11  E > > CATCH                                           last         'Exception'
   32    12    >   ECHO                                                         'Exception+caught%0A'
   33    13    > > RETURN                                                       1

Class A:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/oYWvI
function name:  __toString
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   NEW                                                  $0      'Exception'
          1        SEND_VAL_EX                                                  'Op+gei+lalalei'
          2        DO_FCALL                                          0          
          3      > THROW                                             0          $0
   10     4*       FETCH_OBJ_R                                          ~2      'name'
          5*       VERIFY_RETURN_TYPE                                           ~2
          6*       RETURN                                                       ~2
   11     7*       VERIFY_RETURN_TYPE                                           
          8*     > RETURN                                                       null

End of function __tostring

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.87 ms | 2189 KiB | 13 Q