gevans Posted November 19, 2008 Share Posted November 19, 2008 Hey guys, Just saw a thread that got me thinking, Whenever I need to get data sent with either GET or POST I always use $_REQUEST['foo'] on the other end. I understand that $_POST['foo'] is for POST data, $_GET['foo'] is for GET data and $_REQUEST encompasses POST, GET, COOKIES. But is there any reason to not use $_REQUEST? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 19, 2008 Share Posted November 19, 2008 Personally, i don't like using request as it's not immediately obvious where the data comes from and thus reduces read-ability and makes your code harder to understand. Quote Link to comment Share on other sites More sharing options...
gevans Posted November 19, 2008 Author Share Posted November 19, 2008 I see what you're saying, I tend to comment everything that I'm pulling into my script, so that's not really a problem. Does anyone know of any fesability reasons why one should be used over the other? Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 19, 2008 Share Posted November 19, 2008 I see what you're saying, I tend to comment everything that I'm pulling into my script, so that's not really a problem. Isn't that just a lot more effort? If you wrote your code so it was more self-documenting, you would need so many comments. Comments should be used to explain the program in general, large parts of it or any oddities in the code. As for any other reasons - not really. There's certainly no added security issues; all of the methods of input can be faked by the user, so it makes no difference. It's more to do with personal preference. Quote Link to comment Share on other sites More sharing options...
gevans Posted November 19, 2008 Author Share Posted November 19, 2008 I thought as much, in which case I guess I'm going to stick with $_REQUEST for now, favoured it from the start for some reason Quote Link to comment 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.