PrateekSaxena Posted October 18, 2007 Share Posted October 18, 2007 Hi,I am a complete n00b at PHP.Please tell me the difference between.define(NAME, 'prateek');and $name ='prateek'.Also I am not able to include('some.php?q=t');why is that? Link to comment Share on other sites More sharing options...
Synook Posted October 18, 2007 Share Posted October 18, 2007 For the first one - the former statement defines a constant, which does not change all through script execution, while the latter defines a variable which can be changed.For your second question, you cannot pass querystrings through include() statements, instead just define a variable and read it from the included script $q = t;include("some.php"); Link to comment Share on other sites More sharing options...
justsomeguy Posted October 18, 2007 Share Posted October 18, 2007 For your second question, you cannot pass querystrings through include() statementsTo add to that, $_GET inside an included file refers to the same variables as $_GET outside the file, it's the same array. Using $_GET inside an included files doesn't include any variables in the include statement, only variables in the URL of the page itself. Link to comment Share on other sites More sharing options...
Synook Posted October 18, 2007 Share Posted October 18, 2007 Think of the include() function as simply copying and pasting the code from the included file into your main script. Link to comment Share on other sites More sharing options...
PrateekSaxena Posted October 21, 2007 Author Share Posted October 21, 2007 Sorry for such a delayed reply.is include like require() in ruby? Link to comment Share on other sites More sharing options...
Synook Posted October 22, 2007 Share Posted October 22, 2007 Yes, but there is also a require() function in PHP: http://au.php.net/manual/en/function.require.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.