note 68268 deleted from control-structures.foreach by danbrown
| From: | danbrown@php.net | Date: | Tue, 28 Apr 2009 13:05:41 +0000 |
| Subject: | note 68268 deleted from control-structures.foreach by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153909@lists.php.net to get a copy of this message | ||
Note Submitter: support at mediaart dot ru
----
php at kormoc dot com 11-May-2006 10:25 wrote:
With foreach and references, there is a super easy way to corrupt your data.
But you can avoid it by destruction of the hard link $item
<?php
$array = array(1,2,3);
foreach( $array as &$item );
unset($item);
foreach( $array as $item );
print_r( $array );
?>