|
Posted by Jerry Stuckle on 09/09/07 19:15
Sam Waller wrote:
> I'm trying do do something like this:
>
> $a = array();
> func($a);
> printf("array size in main = %d\r\n", count($a));
>
> /////////////////////////////////////
>
>
> function func($_a) {
> array_push($_a, 22);
> printf("array size in func = %d\r\n", count($_a));
> }
>
>
> This prints:
> array size in main = 0
> array size in func = 1
>
> It looks like the data is no longer available in the calling function. Is there a way to get this to
> work so that I have the computed array available in the calling function?
>
> thanks,
> Sam
>
Your output doesn't make sense. If you were calling func() before the
printf in in your calling routine, your messages would be in the
opposite order.
To answer your question, check out
http://us2.php.net/manual/en/language.references.php.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|