Reply to Re: arrays as function arguments

Your name:

Reply:


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
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация