bonjour,


voici mon code qui doit contenir une erreur

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
$dh = opendir("xxx/xxx");
while (($file = readdir($dh)) !== false)
{
$photos[] = $file;
}
 
foreach ($photos AS $nomphoto)
{
if (ereg('jpg', substr("$nomphoto", -3)) OR ereg('gif', substr("$nomphoto", -3)) OR ereg('JPG', substr("$nomphoto", -3)) OR ereg('GIF', substr("$nomphoto", -3)) )
{
$nombre_photos++;
echo $nombre_photos;
}
}
 
?>
j'obtiens 123 alors que le resultat devrait etre 3 comment puis je afficher le bon resultat?