$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));
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "{URL}/v3/documents?version=2018-05-01",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array('file' => '@curriculum.html','source' => 'en','target' => 'fr'),
CURLOPT_HTTPHEADER => array(
"Authorization: Basic YXBpa2V5OnthcGlrZXl9"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
$before = 1599627581;
$after = time();
if (($after - $before) >= 300)
{
echo 'Прошло 5 минут';
}
<?php
$before = 1599627581; # время от которого веси отсчет
$after = time(); # текущее время
$diff = 5; # сколько должно пройти минут
if (($after - $before) >= ($diff*60))
{
echo 'Прошло 5 минут';
}
$article->find('img.lazy-loaded')->attr('src');
$article->find('img.lazy-loaded')->getAttribute('src');
$json = '[
{
"id": 963343,
"name": "\u0424\u043e\u0440\u043c\u0430 \u0433\u043e\u043b\u043e\u0441\u0430",
"name_eng": "Koe no katachi",
"year": "2016"
},
{
"id": 977743,
"name": "\u0424\u043e\u0440\u043c\u0430 \u0432\u043e\u0434\u044b",
"name_eng": "The Shape of Water",
"year": "2017"
},
{
"id": 493390,
"name": "\u0413\u043e\u043b\u043e\u0441\u0430",
"name_eng": "The Voices",
"year": "2014"
}
]';
$array = json_decode($json, true);
$result = array_filter($array, function($item){
if ($item['name'] == 'Форма голоса' && $item['year'] == '2016') return $item;
});
var_dump($result);