3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array('a', 'b', 'c'); /*foreach($a as $k=>$v){ if($k==1) unset($a[$k]); echo $k.' => '.$v.' ('.$a[$k].')'.PHP_EOL; }*/ for($k=count($a); $k>=0; $k--){ if($k==1) unset($a[$k]); echo $k.' ('.$a[$k].')'.PHP_EOL; } print_r($a);
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined offset: 3 in /in/QbvuS on line 15 3 () 2 (c) Notice: Undefined offset: 1 in /in/QbvuS on line 15 1 () 0 (a) Array ( [0] => a [2] => c )
Output for hhvm-3.10.0 - 3.13.2
Notice: Undefined index: 3 in /in/QbvuS on line 15 3 () 2 (c) Notice: Undefined index: 1 in /in/QbvuS on line 15 1 () 0 (a) Array ( [0] => a [2] => c )
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.2.17
Notice: Undefined offset: 3 in /in/QbvuS on line 15 3 () 2 (c) Notice: Undefined offset: 1 in /in/QbvuS on line 15 1 () 0 (a) Array ( [0] => a [2] => c )
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Undefined offset: 3 in /in/QbvuS on line 15 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/QbvuS on line 15 3 ()PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/QbvuS on line 15 2 (c)PHP_EOL Notice: Undefined offset: 1 in /in/QbvuS on line 15 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/QbvuS on line 15 1 ()PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/QbvuS on line 15 0 (a)PHP_EOLArray ( [0] => a [2] => c )