Why would one work over the other? echo...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Why would one work over the other? echo...

Post by Steveo31 »

I'm new, so please be gentle :)

I'm workin with EasyPHP which involves PHP 4.3 (I think) Apache and mySQL. So far so good, but theres an error over somethin I thought was the same.

Error code:

Code: Select all

<?php
		  $date=date("d-m-y") 
		  echo "$date"
		  ?>
No error Code:

Code: Select all

<?php
		  echo date("d-m-y") 
		  ?>
Can someone explain why?
User avatar
Dr Evil
Forum Contributor
Posts: 184
Joined: Wed Jan 14, 2004 9:56 am
Location: Switzerland

Re: Why would one work over the other? echo...

Post by Dr Evil »

Steveo31 wrote:

Code: Select all

<?php
		  $date=date("d-m-y") 
		  echo "$date"
		  ?>
Can someone explain why?
Add semicolons to your code lines:

Code: Select all

<?php
		  $date=date("d-m-y");
		  echo "$date";
		  ?>
That will do it !

Dr Evil
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

AAGH! I was thinkin about it this morning, and that popped into my head. I'm used to Flash actionscript where it's not necessary. Thanks man.

-S
Post Reply