Previously, I had a global array ($v) and referenced it from within functions by using global $v;. I now want to encapsulate everything about that array, so I wrote a class. In the global context, I instantiate the class:
$vi = new my_v();
Within a function I want to call a method of that object:
function f($x) {
$vi->add($x);
}
How do I refer to $vi within the function?