Advertisement
Ehab_Sherif

Untitled

Mar 21st, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. //Directory To Array
  3. function dirToArray($dir){
  4. $result = array();
  5. $cdir = scandir($dir);
  6. foreach ($cdir as $key => $value){
  7. if (!in_array($value,array(".",".."))){
  8. if (is_dir($dir . DIRECTORY_SEPARATOR . $value)){
  9. $result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
  10. } else {
  11. $result[] = $value;
  12. }
  13. }
  14. }
  15. return $result;
  16. }
  17. print_r(dirToArray("."));
  18.  
  19.  
  20. //Get Files Content
  21. echo file_get_contents('index.php');
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement