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? Link to comment https://forums.phpfreaks.com/topic/133319-what-to-use-for-postget-data/ 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. Link to comment https://forums.phpfreaks.com/topic/133319-what-to-use-for-postget-data/#findComment-693354 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? Link to comment https://forums.phpfreaks.com/topic/133319-what-to-use-for-postget-data/#findComment-693355 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. Link to comment https://forums.phpfreaks.com/topic/133319-what-to-use-for-postget-data/#findComment-693357 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 Link to comment https://forums.phpfreaks.com/topic/133319-what-to-use-for-postget-data/#findComment-693359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.