JREAM Posted September 22, 2008 Share Posted September 22, 2008 I have this trying to print up a directory array, so it would read like: $encoded[0] = '###file1###'; $decoded[0] = 'file1.php'; $encoded[1] = '###file2###'; $decoded[1] = 'file2.php'; or something close to that, doesn't matter -- they just have to match up .. and so on.. Can you see what I am doing wrong? if ($handle = opendir(BLOCKS_DIR)) { $i = 0; while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $encoded[$i] = '####'.removeExt($file).'###'; $decoded[$i] = BLOCKS_DIR . removeExt($file) .'.php'; $i++; } // print_r($encoded); // This prints up a nightmare } closedir($handle); } Here's some of the the Print_r: ##block-3### [8] => ####block-4### [9] => ####block-5### [10] => ####block-6### [11] => ####block-7### ) Array ( [0] => ####a### [1] => ####as### [2] => ####asd### [3] => ####asdasd### [4] => ####block-1### [5] => ####block-10### [6] => ####block-2### [7] => ####block-3### [8] => ####block-4### [9] => ####block-5### [10] => ####block-6### [11] => ####block-7### [12] => ####block-8### ) Array ( [0] => ####a### [1] => ####as### [2] => ####asd### [3] => ####asdasd### [4] => ### Link to comment https://forums.phpfreaks.com/topic/125281-directory-array/ Share on other sites More sharing options...
ranjuvs Posted September 22, 2008 Share Posted September 22, 2008 Try this <pre> <?php print_r($encoded) ?> </pre> Link to comment https://forums.phpfreaks.com/topic/125281-directory-array/#findComment-647585 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.