3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = array(-3,5,1,3,2,10); function array_rev($array) { $half_count = count($array) / 2; for ($i = 0; $i <= $half_count; $i++) { $holder = $array[$i]; $array[i] = $array[(count($array) - (i + 1))]; $array[count($array) - (i + 1)] = $holder; } echo $array; } array_rev($x);
based on oodTq
Output for 7.2.0
Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 8 Warning: A non-numeric value encountered in /in/c3bNW on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 9 Warning: A non-numeric value encountered in /in/c3bNW on line 9 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 8 Warning: A non-numeric value encountered in /in/c3bNW on line 8 Notice: Undefined offset: 7 in /in/c3bNW on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 9 Warning: A non-numeric value encountered in /in/c3bNW on line 9 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 8 Warning: A non-numeric value encountered in /in/c3bNW on line 8 Notice: Undefined offset: 8 in /in/c3bNW on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 9 Warning: A non-numeric value encountered in /in/c3bNW on line 9 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 8 Warning: A non-numeric value encountered in /in/c3bNW on line 8 Notice: Undefined offset: 9 in /in/c3bNW on line 8 Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) in /in/c3bNW on line 9 Warning: A non-numeric value encountered in /in/c3bNW on line 9 Notice: Array to string conversion in /in/c3bNW on line 11 Array
Output for 7.1.0 - 7.1.10
Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Warning: A non-numeric value encountered in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Warning: A non-numeric value encountered in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Warning: A non-numeric value encountered in /in/c3bNW on line 8 Notice: Undefined offset: 7 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Warning: A non-numeric value encountered in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Warning: A non-numeric value encountered in /in/c3bNW on line 8 Notice: Undefined offset: 8 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Warning: A non-numeric value encountered in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Warning: A non-numeric value encountered in /in/c3bNW on line 8 Notice: Undefined offset: 9 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Warning: A non-numeric value encountered in /in/c3bNW on line 9 Notice: Array to string conversion in /in/c3bNW on line 11 Array
Output for 5.4.0 - 7.0.20
Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 7 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 8 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 9 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Array to string conversion in /in/c3bNW on line 11 Array
Output for 5.3.0 - 5.3.29
Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 7 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 8 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 9 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Array
Output for 4.3.0 - 5.2.17
Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 7 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 8 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 8 Notice: Undefined offset: 9 in /in/c3bNW on line 8 Notice: Use of undefined constant i - assumed 'i' in /in/c3bNW on line 9 Array