Reply to problem with array diff, need to reindex array according to key

Your name:

Reply:


Posted by Angelo Zanetti on 09/28/41 11:14

HI all,

I am using the array_diff function.
The problem im having is the array that gets returned. Well here's an
example:

this is where i assign the values to two different arrays

$a[]="0";
$a[]="1";
$a[]="2";
$a[]="3";


$b[]="1";
$b[]="4";
$b[]="0";


$diff = array_diff_assoc($a, $b);

then compare the arrays

print_r ($diff);

then print the difference between array $a and $b


Array ( [2] => 2 [3] => 3 )

now my problem is that although the values are correct the array it
returns, they values have the same keys as the origional array.
Now my problem is that I need to get the return array to be reindexed
because I want to loop through it from element 0 till count($diff).

How do I reindex the returned array by key, to accomplish the above.

thanks in advance

--

Angelo Zanetti

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация