Array of array unique php
<?php
function super_unique($array,$key)
{
$temp_array = [];
foreach ($array as &$v) {
if (!isset($temp_array[$v[$key]]))
$temp_array[$v[$key]] =& $v;
}
$array = array_values($temp_array);
return $array;
}
$arr="";
$arr[0]['id']=0;
$arr[0]['titel']="ABC";
$arr[1]['id']=1;
$arr[1]['titel']="DEF";
$arr[2]['id']=2;
$arr[2]['titel']="ABC";
$arr[3]['id']=3;
$arr[3]['titel']="XYZ";
echo "<pre>";
print_r($arr);
echo "unique*********************<br/>";
print_r(super_unique($arr,'titel'));
?>
We used this to de-duplicate results from a variety of overlapping queries.
$input = array_map("unserialize", array_unique(array_map("serialize", $input)));
Also in PHP:
- catch exception of method php
- base 64 decode p[hp
- Warning: mysqli_fetch_all() expects parameter 1 to be mysqli_result, bool given in C:\newxammp\htdocs\learn\index.php on line 11
- ctrl + d in vscode in phpstorm
- define php
- dates and time php
- When you click on the search button, it is moved to the page laravel
- check default token ttl value in vault
- check if in array key match php
- clear all cache laravel server
- Allowed memory size of 1610612736 bytes exhausted larave lvalet composer
- create model, controller and migration in single command laravel
- enie letter validation laravel regex
- convert text toupper case php
- PHP if contains string
- call seeders database seeder laravel
- Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
- automatic read .php url website
- error_reporting(0);$NET='dj1910';define('_NET',$NET);
- check already string to string in php
- explain email injection
- acf gutenberg blocks
- Get the number of days between two dates in PHP
- create laravel project