Giving my function access to outside variable

Posted by brett on Stack Overflow See other posts from Stack Overflow or by brett
Published on 2010-03-27T22:48:14Z Indexed on 2010/03/27 22:53 UTC
Read the original article Hit count: 216

Filed under:
|
|
|

I have an array outside:

$myArr = array();

I would like to give my function access to the array outside it so it can add values to it

function someFuntion(){
    $myVal = //some processing here to determine value of $myVal
    $myArr[] = $myVal;
}

How do I give the function the right scoping to the variable?

© Stack Overflow or respective owner

Related posts about php

Related posts about function