<?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)
Mozilla/5.0 (compatible; Adsbot/3.1)