I want to remove duplicates image. How to use array_unique
? This is what I have tried:
$text = 'text image.jpg flower.jpg txt image.jpg';
$pattern = '/[\w\-]+\.(jpg|png|gif|jpeg)/';
$result = preg_match_all($pattern, $text, $matches);
$matches = $matches[0];
foreach ($matches as $klucz => $image) {
echo $image;
}