[
...
'sitemap.xml' => 'site/sitemap'
...
]
var userDeviceArray = [
{device: 'Android', platform: /Android/},
{device: 'iPhone', platform: /iPhone/},
{device: 'iPad', platform: /iPad/},
{device: 'Symbian', platform: /Symbian/},
{device: 'Windows Phone', platform: /Windows Phone/},
{device: 'Tablet OS', platform: /Tablet OS/},
{device: 'Linux', platform: /Linux/},
{device: 'Windows', platform: /Windows NT/},
{device: 'Macintosh', platform: /Macintosh/}
];
var platform = navigator.userAgent;
function getPlatform() {
for (var i in userDeviceArray) {
if (userDeviceArray[i].platform.test(platform)) {
return userDeviceArray[i].device;
}
}
return 'Неизвестная платформа!' + platform;
}
console.log('Ваша платформа: ' + getPlatform());
$arr = [
[
'name' => 'Найк',
'desc' => 'Кросовки',
],
[
'name' => 'Адидас',
'desc' => 'Кеды',
],
[
'name' => 'Найк',
'desc' => 'Тапки',
],
];
function sortArr(array $arr){
$result = [
'mark' => [],
'type' => []
];
foreach($arr as $item)
{
if (!in_array($item['name'], $result['mark'])) $result['mark'][] = $item['name'];
if (!in_array($item['desc'], $result['type'])) $result['type'][] = $item['desc'];
}
return $result;
}
var_dump(sortArr($arr));