$domainsosi = $onsameip['name'];
$domainsosi[] = $onsameip['name'];
<?php
$arr = json_decode('[{"id":1,"name":"Ivan","access":true},{"id":2,"name":"Olga","access":false},{"id":1,"name":"Kate","access":false}]
', true);
//удаляем повторы id
$arr = array_intersect_key(
$arr,
array_unique(array_column($arr, 'id' ))
);
//удаляем ключ access
array_walk($arr, function (&$v) {
unset($v['access']);
});
print_r($arr);
<?php
$arr = json_decode('[{"id":1,"name":"Ivan","access":true},{"id":2,"name":"Olga","access":false},{"id":1,"name":"Kate","access":false}]
', true);
$tmp_arr = [];
foreach($arr as $val)
{
if(isset($tmp_arr[$val['id']]))
{
continue;
}
unset($val['access']);
$tmp_arr[$val['id']] = $val;
}
$arr = array_values($tmp_arr);
print_r($arr);
this.array.splice(oldElementIndex, 1, newElement)
this.$set(this.array, oldElementIndex, newElement)
this.array = this.array.map(el => {
el.someParam = 1
return el
})
// меняет два элемента массива in-place
function swap(arr, a, b) {
arr[a] = arr.splice(b, 1, arr[a])[0];
}
const Twelve = [1, 2, 3, 4, 5, 6, 7, 8 ,9 ,10 ,11 ,12];
swap( Twelve, 2, 5); // индексы считаются от 0
swap( Twelve, 7, 11);
swap( Twelve, 9, 4);
Twelve // [1,2,6,4,10,3,7,12,9,5,11,8]