desithugg Posted February 18, 2007 Share Posted February 18, 2007 umm i have a list of picture names example $list = "1.png,2.png,dffd.png,3434.png,32245.png,456.png"; now what I want to do is seperate the list and check if each file exists like if (file_exists($list)) { //if it exists i want it to echo <option value='$list'>$list</a> } is that possiable to have the script run a loop or something? any sujjestions what functions or where i should look Link to comment https://forums.phpfreaks.com/topic/39088-file-exist/ Share on other sites More sharing options...
utexas_pjm Posted February 18, 2007 Share Posted February 18, 2007 <?php $list = "1.png,2.png,dffd.png,3434.png,32245.png,456.png"; $listArray = explode(',', $list); foreach($listArray as $file){ if (file_exists($file)) { echo "<option value='$file'>$file</a>"; } } ?> Link to comment https://forums.phpfreaks.com/topic/39088-file-exist/#findComment-188237 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.