Re: changing table fields value for all found in the list
Yes you have to have "&" in front of $photo. This makes $photo a reference to the element in $photos instead of a copy. If you don't have it then you will be modifying a copy of the array element and not the element itself.
See http://www.php.net/manual/en/language.references.php for a discussion of references in PHP.
On Wednesday, April 17, 2013 12:28:58 PM UTC+3, Chris wrote:
hi david,...--a quick question,...do I have to have "&" upfront of $photoin foreach ($photos as &$photo)and what is it stand for..?thankschris
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home