プロが教える店舗&オフィスのセキュリティ対策術

PHPのforeach構文なのですが以下ソースコードの13行目、foreach文の中の「$juice」なのですが、どこから出てきた物なのでしょうか?
今PHPの参考サイトを見ながら学習という形をとっているのですが
「$juice」が何処から出てきた物かわかりません。
サブライムテキストのラインハイライトで掛けても見つからなかったので...

参考URL
http://creive.me/archives/8719/

<html>
<head><title>accesslog.php</title></head>
<body>
<?php
$fruits_juice = array(
'orange' => 'orange juice',
'melon' => 'melon juice',
'grape' => 'grape juice',
'banana' => 'banana juice',
'strawberry' => 'strawberry juice'
);

foreach ($fruits_juice as $fruit => $juice) {
echo $fruit . "(果物) => " . $juice . "(ジュース)<br>";
}
?>
</body>
</html>

A 回答 (1件)

foreachは配列のキーと値を順番に走査します


$juiceは配列$fruits_juiceの値を順番にうけとるので
'orange juice','melon juice',・・・'strawberry juice'
という値をとってきます
    • good
    • 1

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!