0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【PHP】array_unique関数で配列の重複したデータを削除

Posted at

array_unique関数#

array_unique関数を使うことで、配列の重複したデータを削除することが出来ます。

array_unique.php
 $fruits = ['apple','lemon','strawberry','apple','orange','strawberry','lemomn'];
 $result = array_unique($fruits);
 var_dump($result);
array(5) { 
[0]=> 
string(5) "apple" 
[1]=> 
string(5) "lemon" 
[2]=> 
string(10) "strawberry" 
[4]=> 
string(6) "orange" 
[6]=> 
string(6) "lemomn" 
}

このように重複している値を削除することが出来ました!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?