$input = [
[2, 'скрипт холодного звонка по продаже услуг'],
[2, 'продажи в переписке'],
[2, 'автоматизация отдела продаж'],
[2, 'заказать скрипт продаж'],
[3, 'доставка еды из ресторана'],
[3, 'еда из ресторана на дом'],
[3, 'доставка еды из ресторана на дом'],
[4, 'доставка товаров из китая в россию'],
[4, 'купить в китае с доставкой в россию'],
[4, 'доставка запчастей из китая в россию'],
];
$output = [];
foreach($input as $item) {
if (!array_key_exists($item[0], $output)) {
$output[$item[0]] = [];
}
$output[$item[0]][] = $item[1];
}
$output = array_map(fn($item) => join(', ', $item), $output);
var_dump($output);
class CompatibleBounds {
northEast = [0, 0];
southWest = [0, 0];
constructor(bounds) {
Object.assign(this, bounds);
}
static new(bounds) {
return new this(bounds);
}
get south(){ return this.southWest[1] }
get west(){ return this.southWest[0] }
get north(){ return this.northEast[1] }
get east(){ return this.northEast[0] }
set south(value){ this.southWest[1] = value }
set west(value){ this.southWest[0] = value }
set north(value){ this.northEast[1] = value }
set east(value){ this.northEast[0] = value }
}
const compatibleBounds = CompatibleBounds.new({
"south": 43.106491921792255,
"west": 76.71745650634767,
"north": 43.4065384633472,
"east": 77.13974349365236
});
// или
const compatibleBounds = CompatibleBounds.new({
"northEast": [
76.92894332280319,
43.25695003829279
],
"southWest": [
76.92825667730312,
43.256449960663694
]
});
// на выходе универсальный динамический объект:
compatibleBounds.southWest = [1, 2];
console.log(compatibleBounds.south); // 2
compatibleBounds.south = 3
console.log(compatibleBounds.southWest); // [1, 3]
define( 'CUSTOM_USER_TABLE', $shared_table_prefix . 'my_users' );
define( 'CUSTOM_USER_META_TABLE', $shared_table_prefix . 'my_usermeta' );