I beginner in php.
I have this code:
$string = '["Rumia","Rumia","Joarilla de las Matas","Rumia"]';
How can I remove duplicate from this string?
I build this string by this code:
$res = app('geocoder')->geocode($request->input('city'))->get();
foreach ($res as $value) {
if($formatter->format($value, '%L') !=""){
$string .= '"'.$formatter->format($value, '%L').'"'. ",";
}
}
if (strlen($string) > 0){
$string = mb_substr($string, 0, -1);
echo "[".$string."]";
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/34aTufv
via IFTTT
Aucun commentaire:
Enregistrer un commentaire