MemphiS Posted June 2, 2007 Share Posted June 2, 2007 Just out of interest im sure this question has been asked before.. Difference?Speed? between print(); and echo(); adding () make it slower/faster instead of just going: print ""; or echo ""; Just interested... Another question. while coding.. Example: <?php $go = $_POST['the']; if ($go==1){ ...code to excute } ?> /* Other example */ <?php if ($_POST['the']){ ...code to excute } ?> Just interested if theres any real point to assigning the post to a variable? Save speed by not setting a variable to it? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/53979-few-questions/ Share on other sites More sharing options...
taith Posted June 2, 2007 Share Posted June 2, 2007 with $_POST/$_GET variables... you almost always want to make them more safe... so... i subscribe to this school of thought <?php $go = htmlentities($_POST['the']); if ($go==1){ ...code to excute } ?> in the long run... its really down to the programmer...what works for you... and including the ()'s on print/echo... really arnt necessary... people use em... but i dont see a point in em... just making your code harder to read :-) Quote Link to comment https://forums.phpfreaks.com/topic/53979-few-questions/#findComment-266824 Share on other sites More sharing options...
justoneguy Posted June 2, 2007 Share Posted June 2, 2007 check your messages Quote Link to comment https://forums.phpfreaks.com/topic/53979-few-questions/#findComment-266828 Share on other sites More sharing options...
MemphiS Posted June 2, 2007 Author Share Posted June 2, 2007 hmm thanks for your reply.. =) i kinda like using the () makes it neater to read well i find so though you could still use $_POST['the'] and place $_POST = array_map('htmlentities', $_POST); which would cover all $_POST[] Quote Link to comment https://forums.phpfreaks.com/topic/53979-few-questions/#findComment-266829 Share on other sites More sharing options...
MemphiS Posted June 2, 2007 Author Share Posted June 2, 2007 also.. you can just check the data submited by the user before it goes anywhere. <?php if (!ctype_alnum($_POST['the']){ print("Invalid data."); }elseif (ctype_alnum($_POST['the']){ ...code to excute } ?> hmm Quote Link to comment https://forums.phpfreaks.com/topic/53979-few-questions/#findComment-266831 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.