Isset Vs Yii::app()->Getrequest()->Getparam(...) Which Is The Safest Way To Get A Request?

Hey all,

I recently got to know about Yii::app()->getRequest()->getParam(…) and I’m in doubt if it can replace isset($_POST[…]) along with $val = $_POST[…] without any concerns.

I’ve seen many examples using the second technique, and I’m asking myself why? Why not use the getParam method?

Do any of you guys and gals have any insight about this question?

Cheers!

I do not see why you shouldn’t use the technique with “getParam/getPost/getQuery”.

The reason why many people use $_POST or $_GET is because its sometimes shorter and especially more common when working with PHP (e.g.: It is harder for a newcomer to understand what Yii::app()->request->getQuery(‘q’) means than isset($_GET[‘q’]) […])

An other reason is that some people may unaware of that method which is basicly just a wrapper to $_GET and $_POST.

Thanks. I prefer using the method call, it keeps everything tidy and functional, instead of checking and attributing values, I can do everything in one go :)