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) { assert(false); } } } $test = new ToStringTest; $test = (string) $test;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tEHTY
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'
   18     1        NEW                                              $1      'ToStringTest'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   19     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/tEHTY
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 = 9
Branch analysis from position: 9
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/tEHTY
function name:  __toString
number of ops:  11
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                                                      ->9
   12     3  E > > CATCH                                       last         'Exception'
   13     4    >   ASSERT_CHECK                                             
          5        INIT_FCALL                                               'assert'
          6        SEND_VAL                                                 <false>
          7        SEND_VAL                                                 'assert%28false%29'
          8        DO_ICALL                                                 
   15     9    >   VERIFY_RETURN_TYPE                                       
         10      > RETURN                                                   null

End of function __tostring

End of class ToStringTest.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.64 ms | 1396 KiB | 15 Q