Norman Posted May 25, 2007 Share Posted May 25, 2007 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 More sharing options...
Lulzim Posted May 25, 2007 Share Posted May 25, 2007 to print a variable you should use echo or print <?phpecho $txt;?> http://www.php.net/echo Link to comment Share on other sites More sharing options...
Norman Posted May 25, 2007 Author Share Posted May 25, 2007 -.-Ok, thanks! Is 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 More sharing options...
Lulzim Posted May 25, 2007 Share Posted May 25, 2007 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 More sharing options...
Norman Posted May 25, 2007 Author Share Posted May 25, 2007 Really thanks, Lulzim. Now I've understand. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.