I have a sample code:
$array = array(
1 => "tag/gomobi.html",
2 => "game.html",
3 => "game.php",
4 => "game.html",
5 => "game/game-mobile/feed.html"
);
foreach ($array as $url) {
if(preg_match('/^((.*)\.html)(.*?)$/', $url, $matches)) {
echo $matches[1].'<br />';
}
}
But result can’t remove value same (game.html)
tag/gomobi.html
game.html
game.html
game/game-mobile/feed.html
How to fix it, with result is:
tag/gomobi.html
game.html
game/game-mobile/feed.html
Try: