Reputation: 3231
$arr = array();
function test($status){
global $arr;
array_push($arr,$status);
}
How can I declare $arr as global array.
Upvotes: 0
Views: 1110
Reputation: 2746
To set global variable in Yii use:
Yii::app()->params['arr'] = array();
to get variable:
echo Yii::app()->params['arr'];
Or you can place them in the main.php
config file for each application.
Upvotes: 3