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 Quote 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].'-'; } Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/259295-get-out-of-array/#findComment-1329215 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.