quick and basic question about arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joppe
Forum Newbie
Posts: 7
Joined: Tue Mar 09, 2010 3:18 am

quick and basic question about arrays

Post by joppe »

say you've got 2 arrays á la $arr1 = Array();

you've added some content to both and now you want to replace one's content with the other's (so as to have 2 identical arrays)

will this work?
$arr1 = $arr2;

or do you have to first delete the content of $arr1 and then add each element of $arr2 individually?
iamngk
Forum Commoner
Posts: 50
Joined: Mon Jun 29, 2009 2:20 am

Re: quick and basic question about arrays

Post by iamngk »

$arr1 = $arr2;
will work. it will replace your old value.
joppe
Forum Newbie
Posts: 7
Joined: Tue Mar 09, 2010 3:18 am

Re: quick and basic question about arrays

Post by joppe »

thanks
Post Reply