Page 1 of 1

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

Posted: Mon Feb 09, 2004 12:33 am
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?

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

Posted: Mon Feb 09, 2004 2:46 am
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

Posted: Mon Feb 09, 2004 9:36 am
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