3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $posts = array("pt", "r", "bp"); $posts = array_slice($posts, 0, 3); print_r($posts); for ($i = 0; $i <= 3; $i++){ echo $posts[i]; } ?>
based on khK6M
Output for 7.2.0
Array ( [0] => pt [1] => r [2] => bp ) Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/M2dYi on line 8 Notice: Undefined index: i in /in/M2dYi on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/M2dYi on line 8 Notice: Undefined index: i in /in/M2dYi on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/M2dYi on line 8 Notice: Undefined index: i in /in/M2dYi on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/M2dYi on line 8 Notice: Undefined index: i in /in/M2dYi on line 8
Output for 7.1.10

Process exited with code 137.
Output for 5.3.20 - 7.1.7
Array ( [0] => pt [1] => r [2] => bp ) Notice: Use of undefined constant i - assumed 'i' in /in/M2dYi on line 8 Notice: Undefined index: i in /in/M2dYi on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/M2dYi on line 8 Notice: Undefined index: i in /in/M2dYi on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/M2dYi on line 8 Notice: Undefined index: i in /in/M2dYi on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/M2dYi on line 8 Notice: Undefined index: i in /in/M2dYi on line 8