V
V
Vladimir Yakovlev2018-02-19 20:23:15
PHP
Vladimir Yakovlev, 2018-02-19 20:23:15

How to get only unique values ​​from an array?

It is required to output only unique values.

$a=explode(":","Яндекс.Карты,Google карты,LiveJournal,Dropbox,Google Drive,OpenStreetMaps,Яндекс.Карты,Google карты,Bing,YouTube,OpenStreetMaps,Pinterest,Dropbox,eBay,Skype,Facebook,Google карты,YouTube,Gmail,Here,Instagram,2GIZ,Google карты,Panoramio,Google карты,Яндекс.Карты,Яндекс.Деньги,Яндекс.Деньги,WebMoney,ВКонтакте,Озон,Яндекс.Карты,OpenStreetMap,Twitter,Uber,Gett,Яндекс.Такси,Яндекс,Google карты,Google Street View,Amazon,Google,Google Street View,WinAmp,YouTube,Google карты,The Weather Channel,Reddit,Craigslist,Wordpress,Bootstrap,Dribbble,Google шрифты,WordPress,Baidu Maps,Joomla,Flickr,Одноклассники,Google Drive,Google Drive,Gmail,Google Drive,PayPal,Twitter,Gmail,Google карты,Gmail,Google Drive,Instagram,Netflix,Google,Microsoft,Google Календарь,Adobe,Photoshop,Windows,Android,Google Analytics,Gmail,Dropbox,OneDrive,Google Docs,Google Фото,OpenStreetMaps,Google Street View,Яндекс.Карты,Google карты,Dropbox");

for($e=0;$e<sizeof ($a);$e++) { 
     echo  $a[$e] . "<br/>"; 
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2018-02-19
@simplyv

Get unique values:
www.php.su/array_unique
But this hell:
easily replace
foreach($e as $one)

L
Lander, 2018-02-19
@usdglander

array_unique()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question