I have set this in my main.php file:
'params'=>array(
'TOTAL_ACCOUNT_NUMBER'=>'500100'
)
I can successfully access the data using Yii::app()->params[‘TOTAL_ACCOUNT_NUMBER’]
I would like to pass this as a default to a method like so:
public function myMethod($acctNum=Yii::app()->params['TOTAL_ACCOUNT_NUMBER']) {
...
}
This produces the syntax error: unexpected ‘(‘.
I can probably create a workaround with something like:
public function myMethod($acctNum=null) {
$acctNum = !isset($acctNum) ? Yii::app()->params['TOTAL_ACCOUNT_NUMBER'] : $acctNum;
}
But is there an easier way to format the original method to just avoid the syntax error?
Thanks
You are calling a function inside a parameter list. (Yii::app()) which is, according to your error not allowed in PHP.
from http://php.net/manual/en/functions.arguments.php
Your own workaround would be a nice solution.