3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function __toString() { return spl_object_hash($this); } } $a[(string) new Foo()] = 'bar'; var_dump($a);
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/04HQG
function name:  (null)
number of ops:  10
compiled vars:  !0 = $a
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  13     1        NEW                                              $2      :-6
         2        DO_FCALL                                      0          
         3        CAST                                          6  ~4      $2
         4        ASSIGN_DIM                                               !0, ~4
         5        OP_DATA                                                  'bar'
  15     6        INIT_FCALL                                               'var_dump'
         7        SEND_VAR                                                 !0
         8        DO_ICALL                                                 
         9      > RETURN                                                   1

Class Foo:
Function __tostring:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/04HQG
function name:  __toString
number of ops:  5
compiled vars:  !0 = $this
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   8     0  E >   INIT_FCALL                                               'spl_object_hash'
         1        SEND_VAR                                                 !0
         2        DO_ICALL                                         $1      
         3      > RETURN                                                   $1
   9     4*     > RETURN                                                   null

End of function __tostring

End of class Foo.

Generated using Vulcan Logic Dumper, using php 7.2.0