RE: Re: gloabl & reference behavior question?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22 July 2005 19:47, Surendra Singhi wrote:

> I don't think it will make the code confusing, but the person looking
> at the code should understand how reference and global variables
> work. Using reference variables avoids unnecessary extra copying of
> objects, and while
> using large arrays it can make a big difference in speed.

You shouldn't need to worry about this -- PHP tries to take care of it for
you.  When you copy an array value, PHP only does a "shallow" copy (of the
array's address); if you later modify the array, this triggers a full "deep"
copy of all the array's element values before the modification is done.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux