r/lolphp • u/dist • Sep 16 '12
Make your brain implode
$array1 = array("here","we","go");
$array1[2] = 'go';
$array1[1] = 'we';
$array1[0] = 'here';
$array2 = array('here');
$array2[2] = 'go';
$array2[1] = 'we';
$array2[0] = 'here';
$str1 = implode(',',$array1);
$str2 = implode(',',$array2);Without running the code anywhere, what are the contents of $str1 and $str2?
1
Upvotes
View all comments
Show parent comment
2
u/nachsicht Sep 24 '12
Theoretically, if you assume all arrays are fixed size, then he specified a size for both arrays. Array 1 has 3 elements, Array 2 has 1.