PHP Coding
Moderators: egami, macek, gesf
there is no problem in the code, how are you calling this page?
Change your code to this and call it a PHP page instead of a HTML..
The code above with read on a page like this:
John
John Smith
Code: Select all
<!DOCTYPE HTML>
<html>
<head>
<title>Associative Arrays</title>
</head>
<body>
<?php
$assoc = array("first_name"=>John","last_name"=>"Smith");
echo $assoc["first_name"] . "<br />";
echo $assoc["first_name"]." ".$assoc["last_name"] . "<br />";
?>
</body>
</html>
John
John Smith