maxudaskin Posted February 3, 2008 Share Posted February 3, 2008 What is the difference between ___? echo & print while & do die & exit define(blah,blah) & $blah = blah And any others that may be confusing... Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/ Share on other sites More sharing options...
ratcateme Posted February 3, 2008 Share Posted February 3, 2008 echo read this http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40 do checks the expression at the end instead of the begin not much between exit and die i don't really use define but it assigns case insensitively check this http://nz2.php.net/define Scott. Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/#findComment-456554 Share on other sites More sharing options...
p2grace Posted February 3, 2008 Share Posted February 3, 2008 define is a global variable. You can call it within classes, functions, and pages without having to global it. Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/#findComment-456555 Share on other sites More sharing options...
trq Posted February 3, 2008 Share Posted February 3, 2008 All these questions are answered in the manual if you look, but here we go.... The only difference between print and echo is that echo excepts multiple arguments. While evaluates the expression prior to executing the first time, do does not. Nothing The define function creates constants, not variables. Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/#findComment-456556 Share on other sites More sharing options...
maxudaskin Posted February 3, 2008 Author Share Posted February 3, 2008 If a constant is retrieved the same way as a variable what is the difference between the two? Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/#findComment-456561 Share on other sites More sharing options...
ratcateme Posted February 3, 2008 Share Posted February 3, 2008 the fact you can get them from a function without having to call it specially i think. Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/#findComment-456565 Share on other sites More sharing options...
trq Posted February 3, 2008 Share Posted February 3, 2008 As the name implies, they are constant not variable. Meaning they cannot be changed. And yes, they are also avaliable globally. Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/#findComment-456572 Share on other sites More sharing options...
maxudaskin Posted February 3, 2008 Author Share Posted February 3, 2008 Can you call <?php define("GREETING","Hello you! How are you today?"); echo $GREETING; ?> Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/#findComment-456868 Share on other sites More sharing options...
trq Posted February 3, 2008 Share Posted February 3, 2008 That would be.... <?php define("GREETING","Hello you! How are you today?"); echo GREETING; ?> Link to comment https://forums.phpfreaks.com/topic/89149-solved-what-is-the-difference/#findComment-456873 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.