Kailas
Kailas

Reputation: 3231

Declare global array variable in Yii

$arr = array();

function test($status){
    global $arr;
    array_push($arr,$status);
}

How can I declare $arr as global array.

Upvotes: 0

Views: 1110

Answers (1)

Bfcm
Bfcm

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

Related Questions