Advertisement
henke37

foreach does copy the array

Jun 11th, 2012
1,539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.18 KB | None | 0 0
  1. <?php
  2.  
  3. $arr=array( 0=>"NO",1=>"YES",2=>"MAYBE");
  4.  
  5. foreach($arr as $k=>$v) {
  6. $arr[$k+1]="SURE";
  7. echo "$v\n<br>";
  8. }
  9. ?><hr><?php
  10. foreach($arr as $k=>$v) {
  11. echo "$v\n<br>";
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement