dev-my
см. Как поставить umask по-умолчанию? SELECT * FROM courses
WHERE
( start_event BETWEEN $data_start AND $data_end ) AND
( end_event BETWEEN $data_start AND $data_end )
SELECT * FROM courses
WHERE
( start_event >= $data_start AND start_event <= $data_end ) AND
( end_event >= $data_start AND end_event <= $data_end )
<?php
$arr = json_decode(
json_encode((array) simplexml_load_string($xmlString)), true
);
print_r($arr);
<?php
$arr_1 = '{
"description": "DESC",
"affter": {
"text": "TEXT"
}
}';
$arr_2 = '{
"name": "Название",
"description": "Описание",
"affter": {
"text": "после",
"icon": "иконка до"
}
}';
$arr_1 = json_decode($arr_1, true);
$arr_2 = json_decode($arr_2, true);
$arr_all = [
"name" => $arr_2["name"],
"description" => $arr_1["description"],
"affter" => [
"text" => $arr_1["affter"]["text"],
"icon" => $arr_2["affter"]["icon"],
],
];
$arr_all = json_encode($arr_all, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
echo $arr_all;
$range_str = '10.0.23.40-10.0.25.241';
$networks = IPTools\Range::parse($range_str)->getNetworks();
foreach($networks as $network)
{
echo (string)$network."\n";
}
<?php
$arr = [1,1,2,4,3,1,1,0,1,5,8,9,1,1,2];
$direction = null;
$counter = 0;
foreach($arr as $idx => $val)
{
if(!isset($arr[$idx-1]))
{
continue;
}
if($val > $arr[$idx-1])
{
if($direction != 'incr')
{
$direction = 'incr';
$counter++;
}
}
elseif($val < $arr[$idx-1])
{
if($direction != 'decr')
{
$direction = 'decr';
$counter++;
}
}
else
{
$direction = null;
}
}
var_dump($counter); //int(6)