3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array ( 0 => array ( $this => 3, // instead 0 => 3, 'name' => 'three', ), 1 => array ( $this => 5, // instead 0 => 5, 'name' => 'five', ), 2 => array ( $this => 7, // instead 0 => 7, 'name' => 'seven', ), ); echo $arr[0];
based on mdbZP
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/WaNsk:5 Stack trace: #0 {main} thrown in /in/WaNsk on line 5
Process exited with code 255.
Output for 5.4.1 - 7.0.20
Notice: Undefined variable: this in /in/WaNsk on line 5 Notice: Undefined variable: this in /in/WaNsk on line 9 Notice: Undefined variable: this in /in/WaNsk on line 13 Notice: Array to string conversion in /in/WaNsk on line 18 Array
Output for 5.3.18 - 5.3.29
Notice: Undefined variable: this in /in/WaNsk on line 5 Notice: Undefined variable: this in /in/WaNsk on line 9 Notice: Undefined variable: this in /in/WaNsk on line 13 Array