3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Source: https://bugs.php.net/bug.php?id=60475 class Primary { public function __toString() { $GLOBALS['anObject'] = $this; return 'toString output from Primary'; } } $Foo = new Primary; str_replace('', '', $Foo); var_dump($GLOBALS['anObject']); // expected to be object of class Primary, actually string
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/43lsq
function name:  (null)
number of ops:  15
compiled vars:  !0 = $Foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'primary'
    9     1        NEW                                              $1      'Primary'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   10     4        INIT_FCALL                                               'str_replace'
          5        SEND_VAL                                                 ''
          6        SEND_VAL                                                 ''
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   11     9        INIT_FCALL                                               'var_dump'
         10        FETCH_R                      global              ~5      'GLOBALS'
         11        FETCH_DIM_R                                      ~6      ~5, 'anObject'
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                                 
   12    14      > RETURN                                                   1

Class Primary:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/43lsq
function name:  __toString
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_THIS                                       ~2      
          1        FETCH_W                      global              $0      'GLOBALS'
          2        ASSIGN_DIM                                               $0, 'anObject'
          3        OP_DATA                                                  ~2
    6     4      > RETURN                                                   'toString+output+from+Primary'
    7     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function __tostring

End of class Primary.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.62 ms | 1395 KiB | 17 Q