array_unique() function removes the duplicate values from an array.if two or more array values an the same ,the sirst apperence will be kept and the other will be removed
Syntax
arrray_unique(array)
Example
Output
before using array unique
array(0=>apple
1=>orange
2=>apple)
after using array unique
array(0=>apple
1=>orange)
Syntax
arrray_unique(array)
Example
<?php $sum=array(0=>"apple",1=>"orange",2=>"apple",); echo "before using array unique"; print_r($sum); echo "after using array unique"; print_r(array_unique($sum)); ?> |
before using array unique
array(0=>apple
1=>orange
2=>apple)
after using array unique
array(0=>apple
1=>orange)
0 comments:
Post a Comment