//add any lang => option_* pairs here
$langs = [
'general' => 'option_title',
'en' => 'option_title_en',
'ru' => 'option_title_ru',
'am' => 'option_title_am',
];
$placesSelectizeOptionsArray = [];
foreach($places as $place)
{
$option = [];
foreach($langs as $lang => $title_key)
{
//has parent_name_*
if(isset($place['option_parent_name_'.$lang]))
{
$option[$title_key] =
$place['option_name_'.$lang] .
' (' . $place['option_type_'.$lang] .
$this->getTranslator()->translate(' of ') .
$place['option_parent_name_'.$lang] .
' ' . $place['option_parent_type_'.$lang] . ')';
}
elseif(isset($place['option_name_'.$lang]))
{
$option[$title_key] =
$place['option_name_'.$lang] .
' (' . $place['option_type_'.$lang] . ')';
}
}
$placesSelectizeOptionsArray[] = $option;
}
function secToArray($secs)
{
$res = array();
$res['days'] = floor($secs / 86400);
$secs = $secs % 86400;
$res['hours'] = floor($secs / 3600);
$secs = $secs % 3600;
$res['minutes'] = floor($secs / 60);
$res['secs'] = $secs % 60;
return $res;
}
$result
это ваш array
тогда выводите такforeach($result['data'] as $transaction)
{
echo $transaction['txnId'];
echo $transaction['provider']['shortName'];
}
<?php
$checkDate1 = new DateTime("2020-06-25");
$checkDate2 = new DateTime("2020-01-30");
$startDate = new DateTime("2020-06-20 00:00:00");
$endDate = new DateTime("2020-06-30 23:59:59");
//bool(true)
var_dump(
isDateBetweenDates($checkDate1, $startDate, $endDate)
);
//bool(false)
var_dump(
isDateBetweenDates($checkDate2, $startDate, $endDate)
);
function isDateBetweenDates(DateTime $date, DateTime $startDate, DateTime $endDate) {
return $date > $startDate && $date < $endDate;
}
$user = \R::load('users', $id);
$user_roles = \R::load('roles', $user->id); //изменить под себя
$user_roles
(проверка роли "кого удаляем") а так же можно оставить проверку $_SESSION['user']['role_id']
(роль "кто удаляет") чтобы удалять мог только админ, всех "не админов" SELECT
DATE_FORMAT(created_at, '%Y-%m-%d') AS date_ymd
,SUM(orders) AS num_orders
,SUM(rejections) AS num_rejections
FROM table
GROUP BY date_ymd
foreach($month as $day)
) или если в бд данных за какой-то день нет выводим нули. <?php
$strings = [
'https://site.ru/#top 7 (499) 999-99-99;',
'7 (499) 999-99-99; https://site.ru/#top',
];
foreach($strings as $str)
{
print_r(extract_data($str));
}
function extract_data($str)
{
preg_match('!(https?://[^\s]+)!si', $str, $out);
$url = $out[1] ?? '';
$str = str_replace($url, '', $str);
$phone = trim(preg_replace('![^0-9\(\)\-\ ]+!si', '', $str));
return [
'url' => $url,
'phone' => $phone
];
}
Array
(
[url] => https://site.ru/#top
[phone] => 7 (499) 999-99-99
)
Array
(
[url] => https://site.ru/#top
[phone] => 7 (499) 999-99-99
)