lnenad Posted December 3, 2008 Share Posted December 3, 2008 I'm trying to compare arrays, so i'm checking if an element from array1 is not in array2 and if that happens add that element from array1 to array2 But no matter how i try to write not in it gives me bunch of errors. if (!in_array($svi[$s],$ukupno)) { $ukupno += $svi[$s]; } Fatal error: Unsupported operand types in xxx on line 80 Even when i try != true and == false or != 1 still i gives me an error, how do i fix this? Link to comment https://forums.phpfreaks.com/topic/135358-solved-not-in-array/ Share on other sites More sharing options...
cooldude832 Posted December 3, 2008 Share Posted December 3, 2008 maybe http://us3.php.net/manual/en/function.array-diff-assoc.php Link to comment https://forums.phpfreaks.com/topic/135358-solved-not-in-array/#findComment-705020 Share on other sites More sharing options...
flyhoney Posted December 3, 2008 Share Posted December 3, 2008 if (!in_array($svi[$s],$ukupno)) { $ukupno[] = $svi[$s]; } Link to comment https://forums.phpfreaks.com/topic/135358-solved-not-in-array/#findComment-705025 Share on other sites More sharing options...
premiso Posted December 3, 2008 Share Posted December 3, 2008 $ukupno += $svi[$s]; Thats what's throwing the error. if (!in_array($svi[$s],$ukupno)) { $ukupno[] = $svi[$s]; } Hope that helps. Link to comment https://forums.phpfreaks.com/topic/135358-solved-not-in-array/#findComment-705030 Share on other sites More sharing options...
lnenad Posted December 3, 2008 Author Share Posted December 3, 2008 $ukupno += $svi[$s]; Thats what's throwing the error. if (!in_array($svi[$s],$ukupno)) { $ukupno[] = $svi[$s]; } Hope that helps. That did the trick, thanks a lot man ! Link to comment https://forums.phpfreaks.com/topic/135358-solved-not-in-array/#findComment-705042 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.