What elements will be in the $a array after executing following code?
<?php
$a = array(1,2,3);
foreach ( $a as $key => &$value ) {
    $value = 1;
}
$value = 2;
?>
Explanation
Reference &$value saved after executing foreach.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
PHP quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes