Wednesday, 15 January 2014

php - I can not get config variable value in a function as a parameter -



php - I can not get config variable value in a function as a parameter -

my problem want phone call function value parameter of function config of laravel scheme follows:

public function functionname($parametername = config::get('app.varname')) { ... }

i know seems crazy need phone call value config in many functions default parameter. naturally above, returns syntax error. suggestion appreciated. thanks.

try shorthand if:

public function functionname($parametername = null) { $parametername = $parametername ?: config::get('app.varname'); }

php laravel parameters laravel-4 parameter-passing

No comments:

Post a Comment