Example of syntax highlighing in PHP
<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>
How can I highlight my PHP program like this?
Example taken from our PHP Programming course
Well House Consultants, 2008