<head>
<title>Array lookup, with check etc</title>
</head>
<body bgcolor=white>
Who lives where?<BR>
<?php
#%% Array_walk example. Also the difference between null and empty
function prwho($person,$addy) {
$person or $person = "no-one";
print ("$person lives in $addy<BR>");
}
$home = array( 1 => "John Smith",
2 => "Daphne Jones",
3 => "Ronald McDonald",
4 => "",
"221B" => "Sherlock Holmes",
84 => "Pizza Hut" );
if ($house = $_GET[house]) {
if ($home[$house]) {
print ("In $house lives $home[$house]");
} else {
if (is_string($home[$house])) {
print ("$house is empty");
} else {
print ("Don't know about $house");
}
}
} else {
print ("So you want a street listing then?<BR>");
array_walk($home,"prwho");
}
?>
</body>
|
This is http://www.wellho.net/demo/shigh.php4 Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY Phone: +44 (0) 1225 708 225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net |