• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
default value paramater for get/post/cookie input class

#1
[eluser]Unknown[/eluser]
I don't see any better outlet for this type of recommendation - I would love to contribute more to CI as my team and I have been using it recently on several projects.

Anyway, instead of sending a default value of false if a parameter is not set, I would recommend that it be a third option in the function.

For example:

Code:
function post($index = '', $xss_clean = FALSE, $default = FALSE)
    {
        if ( ! isset($_POST[$index]))
        {
            return $default;
        }

Instead of returning false, I could assign a default value (which, by if not provided is false). I frequently need to assign something else, like a string or a non-zero integer.

I would recommend this for the get/post functions, if not the cookie/session functions as well.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.