1
I have a code where I want to show the files that are inserted.
The names are contained in a array
I will search the database. They are presented the way I want but is there any way to sort? Like for example appear images first and then others without extension? I have my code.
<?php
$count=explode(",", $mos['files']);
foreach($count as $i){
$ext=substr($i, strpos($i, ".") + 1);
if($ext=="png" || $ext=="PNG" || $ext=="jpg" || $ext=="JPEG" || $ext=="JPG" || $ext=="jpeg"){
echo '<img src="../images/documentos/'.$i.'" />';
}else{
echo '<li>'.$i.'</li>';
}
}
?>
I give as an example the following array
: ajax.png,array.pdf,algo.jpg,tres.docx,sentido.doc
has an example of
array
?– novic
@Virgilionovic I added information to the question.
– I_like_trains