3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(1,2,3,4,5); $l = count($a); for ($i=0; $i < $l-2; $i++) { echo $a[$i]; } echo $a[l-1]; echo $a[l];
based on Z2j9c
Output for 7.1.0
123 Notice: Use of undefined constant l - assumed 'l' in /in/pBrru on line 7 Warning: A non-numeric value encountered in /in/pBrru on line 7 Notice: Undefined offset: -1 in /in/pBrru on line 7 Notice: Use of undefined constant l - assumed 'l' in /in/pBrru on line 8 Notice: Undefined index: l in /in/pBrru on line 8
Output for 5.3.0 - 7.0.14
123 Notice: Use of undefined constant l - assumed 'l' in /in/pBrru on line 7 Notice: Undefined offset: -1 in /in/pBrru on line 7 Notice: Use of undefined constant l - assumed 'l' in /in/pBrru on line 8 Notice: Undefined index: l in /in/pBrru on line 8
Output for 4.3.0 - 5.2.17
123 Notice: Use of undefined constant l - assumed 'l' in /in/pBrru on line 7 Notice: Undefined offset: -1 in /in/pBrru on line 7 Notice: Use of undefined constant l - assumed 'l' in /in/pBrru on line 8 Notice: Undefined index: l in /in/pBrru on line 8