天天看點

php 關聯數組

<?php

$food['apple']="蘋果";

$food['orange']="橘子";

$food['banana']="香蕉";

foreach ($food as $key => $value) {

# code...

echo $key;

echo $value;

}

?>

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<title>Examples</title>

<meta name="description" content="">

<meta name="keywords" content="">

<link href="" rel="stylesheet">

</head>

<body>

</body>

</html>

php