PHP program to accept directory name and print its all subdirectories

 To get the subdirectories present in a directory, code are below -

Example - 


<?php
   $somePath = 'E:\xampp\htdocs\drupal';
   $all_dirs = glob($somePath . '/*' , GLOB_ONLYDIR);
   echo "<pre>";
   print_r($all_dirs);
?>



Output - 


Array
(
    [0] => E:\xampp\htdocs\drupal/New folder
    [1] => E:\xampp\htdocs\drupal/core
    [2] => E:\xampp\htdocs\drupal/modules
    [3] => E:\xampp\htdocs\drupal/profiles
    [4] => E:\xampp\htdocs\drupal/sites
    [5] => E:\xampp\htdocs\drupal/themes
    [6] => E:\xampp\htdocs\drupal/vendor
)

No comments:

Write a program in PHP to reverse a number

A number can be written in reverse order. For example 12345 = 54321 <?php   $ num = 23456;   $ revnum = 0;   while ($ num > 1)   {   $...