3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array( casa => 'string1', casa => 'string2', 4 => 'string3', 5 => 'string4'); $arrays =$array; print_r($array); $array=array(); $i=0; foreach($arrays as $k => $item) { $array[$i]=$item; unset($arrays[$k]); $i++; } print_r($array);
based on unrGQ
Output for 7.2.0
Warning: Use of undefined constant casa - assumed 'casa' (this will throw an Error in a future version of PHP) in /in/Isn1n on line 3 Warning: Use of undefined constant casa - assumed 'casa' (this will throw an Error in a future version of PHP) in /in/Isn1n on line 3 Array ( [casa] => string2 [4] => string3 [5] => string4 ) Array ( [0] => string2 [1] => string3 [2] => string4 )
Output for 5.3.22 - 7.1.10
Notice: Use of undefined constant casa - assumed 'casa' in /in/Isn1n on line 3 Notice: Use of undefined constant casa - assumed 'casa' in /in/Isn1n on line 3 Array ( [casa] => string2 [4] => string3 [5] => string4 ) Array ( [0] => string2 [1] => string3 [2] => string4 )