I want to get an extension of a file but the name of some images comes type:
adsfasdfasd.234.asdfa.3rfr.jpg
asdfsdafasdfasdf.45eg.png
I'm trying to use the code:
<?php
if(is_dir("img/$noticia->idnoticia"))
{
$diretorio = "img/$noticia->idnoticia/";
if ($handle = opendir($diretorio)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
list($arquivo, $ext) = explode(strrchr($file,"."),$file);
if(($ext!="mp3")AND($ext!="wav")){
echo "<li><img src='$diretorio$arquivo.$ext'></li>";
But the result is .
.
Any tips?