manalnor Posted March 19, 2012 Share Posted March 19, 2012 Hello dear friends, I'm using scandir function to get all directories but it gives results in array and i don't want it in array so how can i get out of this array. <?php $dir = '/tmp'; // my directory $files = scandir($dir); print_r($files); ?> The output is an array Array ( [0] => iono [1] => toto [2] => soso [3] => fofo [4] => dod ) But i want to get the directories names without being set in an array so i want the output but iono - toto - soso - fofo - dodo ....etc , I mean in any way but not in array Thanks a lot for help Link to comment https://forums.phpfreaks.com/topic/259295-get-out-of-array/ Share on other sites More sharing options...
samshel Posted March 19, 2012 Share Posted March 19, 2012 for($i=0;$i<count($files);$i++){ echo $files[$i].'-'; } Link to comment https://forums.phpfreaks.com/topic/259295-get-out-of-array/#findComment-1329210 Share on other sites More sharing options...
manalnor Posted March 19, 2012 Author Share Posted March 19, 2012 Thanks a lot @samshel this is perfect and do exactly what i need Link to comment https://forums.phpfreaks.com/topic/259295-get-out-of-array/#findComment-1329215 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.