<?php
$array = array('aaa', 'bbb', 'aaa', 'ccc', 'ddd', 'ccc', 'eee');
foreach($array as $a){
echo $a;
}
Is possible use some like DISTINCT for foreach? I would like show each values only one, without repeat. How is the best way for this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually
array_unique()gets pretty bad when you have large arrays. You would be better off with$uniques = array_flip(array_flip($array)).