There is a code:
$arr= array( 2, 5, 9, 15, 0, 4); foreach ($arr as $key=>$value){ if ($value < 10 && $value>3) echo "\$arr[$key] = $value </br> "; } Conclusion:
$arr[1] = 5 $arr[2] = 9 $arr[5] = 4; If in the line echo "\$arr[$key] = $value </br> " we remove \ output will be the following:
5 = 5 9 = 9 4 = 4 I just can't understand why not
1 = 5 2 = 9 5 = 4 Explain, please.
$arr[$key], which is equivalent to$value. And with a slash, only the$keyoutput, since the array itself is escaped (\$perceived as a simple symbol, not a variable call) and no search is performed on it. For the line you need, useecho "$key = $value </br> "- Alex Krass