Problem With Global Scope

Hello! I have a script that need to integrate in Yii. And I have a problem with global scope of one variable.

SomeController.php




function actionTest(){

  Yii::import('ext.test.*');

  require_once 'test.php';

}



test.php




include 'utils.php';

$result['data'] = array( /* some data */ );

finish('OK');



utils.php




$result = array();


function finish($status, $emessage=NULL, $edata=NULL) {

    global $result;

    var_dump( $result ); // always null

}



How make it works?

Life hack in utils.php




global $result;

$result = array();