Jump to content

array_diff Now I am Confused!!!!


StefanRSA

Recommended Posts

Why is this not working???

 

If $adsused prints out: 1, 5, 6, 7,

while ($tarray=mysql_fetch_array($admintotadsq)){
$adsused .= $tarray['adnr'].', ';
}
$array1 = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
$array2 = array($adsused);
$diff = array_diff($array1, $array2);
print_r($diff);

 

print_r($diff); prints out: Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 [9] => 10 [10] => 11 [11] => 12 [12] => 13 [13] => 14 [14] => 15 [15] => 16 [16] => 17 [17] => 18 [18] => 19 [19] => 20 )

 

What am I doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/209638-array_diff-now-i-am-confused/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.