guttyguppy Posted September 3, 2009 Share Posted September 3, 2009 <?php function $saywords() { return "hello world"; } $theword = $saywords(); ?> <html> <head> </head> <body> <?php echo $theword; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/173043-whats-wrong-with-this-code/ Share on other sites More sharing options...
ldb358 Posted September 3, 2009 Share Posted September 3, 2009 why do you assume there is some thing wrong? what error are you getting? edit: wow i missed that Link to comment https://forums.phpfreaks.com/topic/173043-whats-wrong-with-this-code/#findComment-912074 Share on other sites More sharing options...
rhodesa Posted September 3, 2009 Share Posted September 3, 2009 get rid of the $ in front of the function name: <?php function saywords() { return "hello world"; } $theword = saywords(); ?> <html> <head> </head> <body> <?php echo $theword; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/173043-whats-wrong-with-this-code/#findComment-912075 Share on other sites More sharing options...
guttyguppy Posted September 3, 2009 Author Share Posted September 3, 2009 Yeah, the $ is obvious-thanks for noting that, I fixed it-- but "hello world" still doesn't appear on the page. I don't get any errors, which is also a problem. I wish I did, but I can't find the right php code to paste at the top of my page so that I get error reporting (php.net is way confusing) Link to comment https://forums.phpfreaks.com/topic/173043-whats-wrong-with-this-code/#findComment-912081 Share on other sites More sharing options...
MatthewJ Posted September 3, 2009 Share Posted September 3, 2009 Works fine for me Link to comment https://forums.phpfreaks.com/topic/173043-whats-wrong-with-this-code/#findComment-912082 Share on other sites More sharing options...
guttyguppy Posted September 4, 2009 Author Share Posted September 4, 2009 so it was the $. I guess I did it wrong, thanx Link to comment https://forums.phpfreaks.com/topic/173043-whats-wrong-with-this-code/#findComment-912128 Share on other sites More sharing options...
bundyxc Posted September 4, 2009 Share Posted September 4, 2009 Indent moar. <?php function saywords() { return "hello world"; } $theword = saywords(); ?> <html> <head> </head> <body> <?php echo($theword); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/173043-whats-wrong-with-this-code/#findComment-912202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.