|
Posted by Iain Adams on 08/11/06 09:06
Cheers Chung, that worked!!!!
Chung Leong wrote:
> Iain Adams wrote:
> > Hey i have a loop like so,
> >
> >
> > foreach($users as $user)
> > {
> > foreach($syncWebUsers as $sync)
> > {
> > //user already synched
> > if($sync['crmid'] == $user[$crmid])
> > {
> > echo "User Already
> > Synched".$user[$crmid];
> > unset($user);
> > }
> > }
> > }
> >
> > Now I wanted this to completely remove the sub array $user from $users
> > but when $users remains unchanged when I print_r it. I guess this is to
> > do with referencing things. Does anyone know how to combat this problem.
>
> No, not really. Unsetting $user will unset $user, not something in in
> $users. To unset the element in $users, you have to specify it. Hence:
>
> foreach($users as $user_index => $user) {
> ...
> unset($users[$user_index]);
> ...
> }
Navigation:
[Reply to this message]
|