PHP Coding

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
pbs
New php-forum User
New php-forum User
Posts: 53
Joined: Sat May 11, 2013 1:40 am
Location: Nashik, India
Contact:

Thu Jul 18, 2013 1:43 am

there is no problem in the code, how are you calling this page?

johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Thu Jul 18, 2013 8:45 pm

I don't see anything wrong with the code. The output looks ok to me.

cappy2354

Wed Sep 11, 2013 10:08 am

Change your code to this and call it a PHP page instead of a HTML..

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"]."&nbsp;".$assoc["last_name"] . "<br />";
?>
</body>
</html>
The code above with read on a page like this:
John
John Smith

Post Reply