Why are we saying SLUG = FALSE? |
1. http://php.net/manual/en/functions.argum...ts.default
A function/method may define default values for arguments, in this case, the default value of $slug is FALSE. If you call get_news() without supplying an argument, $slug will be FALSE. 2. http://php.net/manual/en/function.return.php Since the last statement inside the curly braces for the if statement is Code: return $query->result_array(); 3. Yes, unless you change the code outside the curly braces to change the return type and only set the where clause when $slug !== FALSE. For example: PHP Code: public function get_news($slug = FALSE) Since this is probably more confusing than the original code, you're probably better off with what you already have. |
Messages In This Thread |
Why are we saying SLUG = FALSE? - by lexxtoronto - 03-18-2015, 01:12 PM
RE: Why are we saying SLUG = FALSE? - by mwhitney - 03-18-2015, 01:25 PM
RE: Why are we saying SLUG = FALSE? - by lexxtoronto - 03-18-2015, 01:55 PM
RE: Why are we saying SLUG = FALSE? - by CroNiX - 03-18-2015, 02:27 PM
RE: Why are we saying SLUG = FALSE? - by lexxtoronto - 03-18-2015, 06:17 PM
RE: Why are we saying SLUG = FALSE? - by mwhitney - 03-19-2015, 08:01 AM
RE: Why are we saying SLUG = FALSE? - by lexxtoronto - 04-08-2015, 06:07 PM
|