3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ToStringTest { function toString() { echo 'toString'; throw new Exception('error'); } function __toString() { try { $this->toString(); } catch (\Exception $e) { echo 'hey, this is not cool'; return NULL; } } } $test = new ToStringTest; $test = (string) $test;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiUjR
function name:  (null)
number of ops:  7
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'tostringtest'
   19     1        NEW                                              $1      'ToStringTest'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   20     4        CAST                                          6  ~4      !0
          5        ASSIGN                                                   !0, ~4
          6      > RETURN                                                   1

Class ToStringTest:
Function tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/LiUjR
function name:  toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'toString'
    6     1        NEW                                              $0      'Exception'
          2        SEND_VAL_EX                                              'error'
          3        DO_FCALL                                      0          
          4      > THROW                                         0          $0
    7     5*     > RETURN                                                   null

End of function tostring

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 3
Branch analysis from position: 3
2 jumps found. (Code = 107) Position 1 = 4, Position 2 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiUjR
function name:  __toString
number of ops:  9
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_METHOD_CALL                                         'toString'
          1        DO_FCALL                                      0          
          2      > JMP                                                      ->7
   12     3  E > > CATCH                                       last         'Exception'
   13     4    >   ECHO                                                     'hey%2C+this+is+not+cool'
   14     5        VERIFY_RETURN_TYPE                               ~2      null
          6      > RETURN                                                   ~2
   16     7    >   VERIFY_RETURN_TYPE                                       
          8      > RETURN                                                   null

End of function __tostring

End of class ToStringTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.14 ms | 1386 KiB | 13 Q