3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $data = array(0 => 'one', 1 => 'two', 2 => 'three', 3 => 'four', 4 => 'five'); foreach(array_values($data) as $key=>$value) { $order = $key + 1; echo "${key + 1}. $value\n"; }
based on 9JgCS
Output for 7.2.0
Warning: Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . one Warning: Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . two Warning: Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . three Warning: Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . four Warning: Use of undefined constant key - assumed 'key' (this will throw an Error in a future version of PHP) in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . five
Output for 7.1.0 - 7.1.10
Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . one Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . two Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . three Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . four Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Warning: A non-numeric value encountered in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . five
Output for 5.5.0 - 5.6.30, hhvm-3.10.1 - 3.17.3, 7.0.0 - 7.0.20
Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . one Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . two Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . three Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . four Notice: Use of undefined constant key - assumed 'key' in /in/8hh2P on line 5 Notice: Undefined variable: 1 in /in/8hh2P on line 5 . five
Output for 5.0.4 - 5.4.45
Notice: Undefined variable: 1 in /in/8hh2P on line 5 . one Notice: Undefined variable: 1 in /in/8hh2P on line 5 . two Notice: Undefined variable: 1 in /in/8hh2P on line 5 . three Notice: Undefined variable: 1 in /in/8hh2P on line 5 . four Notice: Undefined variable: 1 in /in/8hh2P on line 5 . five
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: 1 in /in/8hh2P on line 5 . one Notice: Undefined variable: 1 in /in/8hh2P on line 5 . two Notice: Undefined variable: 1 in /in/8hh2P on line 5 . three Notice: Undefined variable: 1 in /in/8hh2P on line 5 . four Notice: Undefined variable: 1 in /in/8hh2P on line 5 . five