I have a 2d array that includes 'title' and 'url' (both strings) as shown below Is it possible to check a duplicate in 'URL' and if it is present then remove this 'title' too?
array 0 = & gt; Array 'title' = & gt; String 'china - Wikipedia, free encyclopedia' URL '=> String 'http://en.wikipedia.org/wiki/China' 1 = & gt; Array 'title' = & gt; String 'china' 'url' = & gt; The string 'http://www.state.gov/r/pa/ei/bgn/18902.htm' 2 = & gt; Array 'title' = & gt; String 'china | World News | Guardian 'url' = & gt; String 'http://www.guardian.co.uk/world/china' 3 = & gt; Array 'title' = & gt; String 'China Travel Information and Travel Guide - Lonely Planet' 'url' = & gt; String 'http://www.lonelyplanet.com/china' 4 = & gt; Array 'title' = & gt; String 'ChinaToday.com' 'url' = & gt; String 'http://www.chinatoday.com/'
this function try it out Can work
function super_unique ($ array, $ key) {$ temp_array = array (); Forex Currency ($ Array & amp; $ V) {If (!! ($ Temp_array [$ v [$ key]]) $ temp_array [$ v [$ key]] = & amp; $ V;} $ Array = array_values ($ temp_array); $ Array return;} $ Yourearray = super_unique ($ arr, 'url');
Comments
Post a Comment