CodeIgniter Forums
NULL parameters in controller method - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: NULL parameters in controller method (/showthread.php?tid=47592)



NULL parameters in controller method - El Forum - 12-14-2011

[eluser]Unknown[/eluser]
Let's say I have a method like this:

Code:
function search($query=NULL, $limit=5, $offset=0)
{

}

Now, if nothing is passed to $query it messes up my URL structure. I could make it $query=0, but then I would have an unnecessary 0 in my URL.

Is there another way to do this?