Jump to content

Noob Question about Variables


Norman

Recommended Posts

Hi, I've a noob question! :)In a .php file I've this:

<?php $txt = "Hello World!";$number = 5;?><?php $txt?>

But when browsered in my browser, nothing is print. What's wrong?

Link to comment
Share on other sites

-.-Ok, thanks! asd.gifIs there some differences between print and echo?And another question. I've try to use this: echo $number--But it still print "5", and not "4". What's wrong?

Link to comment
Share on other sites

The only differece I know is that print returns a true/false value and echo does not return anything.

echo $number--;

In this case variable $number is decremented after it is used.

$number = 5;echo $number--; //output is 5echo $number;	//output is 4$echo --$number;  //output is 3

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...