Hello,
Tom Rogers wrote:
>
> Hi
> What is the scope of the array that holds the object ?
global
> Maybe a bit of code to show what you are after :)
It is to implement another function that will return a reference (not a
copy) of a object stored in a global array passing the index of the
array. It would be like this, except that this code does not work as I
need:
$objects=array();
Function CreateObject(&$index)
{
global $objects;
$index=count($objects);
$objects[$index]=new my_class;
}
Function GetObject($index,&$object)
{
global $objects;
$object= &$objects[$index];
}
CreateObject($index);
GetObject($index,$my_object);
Regards,
Manuel Lemos
> Tom
>
> At 03:37 PM 17/12/01, Manuel Lemos wrote:
> >Hello,
> >
> >Tom Rogers wrote:
> > >
> > > Hi again
> > > Got a bit sidetracked ... here is your original code :)
> >
> >Thanks, I managed to make it work for me similarly to that.
> >
> >Now, a different problem, I already have array variable with a object.
> >Is there a way to make a function return a reference to that object in a
> >variable passed by reference to a function?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]