robert_gsfame Posted April 29, 2010 Share Posted April 29, 2010 lets assume i have this on url: test1.php?itemx=1;2;3;4&itemy=2;3 so then i will explode each item itemx=explode(";",$_GET['itemx']) itemy=explode(";",$_GET['itemy']) what i want to do is to have another string call $itemz which is the difference between itemx and itemy, therefore the itemz should consist of 1;4 how can i do it with loop?? Link to comment https://forums.phpfreaks.com/topic/200161-looping-logical-problem/ Share on other sites More sharing options...
Ken2k7 Posted April 29, 2010 Share Posted April 29, 2010 Pick one of the to loop through. Check if the value is in the other array. If yes, remove it. That's the logic. Pretty simple. Link to comment https://forums.phpfreaks.com/topic/200161-looping-logical-problem/#findComment-1050513 Share on other sites More sharing options...
litebearer Posted April 29, 2010 Share Posted April 29, 2010 might look into... array_diff Link to comment https://forums.phpfreaks.com/topic/200161-looping-logical-problem/#findComment-1050515 Share on other sites More sharing options...
robert_gsfame Posted April 29, 2010 Author Share Posted April 29, 2010 I got this statement ARRAY ?? i explode both strings and use the array_diff but got this statement... Link to comment https://forums.phpfreaks.com/topic/200161-looping-logical-problem/#findComment-1050520 Share on other sites More sharing options...
robert_gsfame Posted April 29, 2010 Author Share Posted April 29, 2010 okay i got it !! thx litebearer!! Link to comment https://forums.phpfreaks.com/topic/200161-looping-logical-problem/#findComment-1050525 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.