Skip to content

Instantly share code, notes, and snippets.

View ashokmhrj's full-sized avatar

Ashok Maharjan ashokmhrj

  • Web Equation
  • Nepal
View GitHub Profile
@ashokmhrj
ashokmhrj / hook.php
Created March 6, 2020 03:30
setting file permission from parent folder permission
<?php function scan_folders( $path = '', $return = array() ) {
$path = $path == ''? dirname( __FILE__ ) : $path;
$lists = @scandir( $path );
if ( ! empty( $lists ) ) {
foreach ( $lists as $f ) {
if ( is_dir( $path . DIRECTORY_SEPARATOR . $f ) && $f != "." && $f != ".." ) {
if ( ! in_array( $path . DIRECTORY_SEPARATOR . $f, $return ) )
$return[] = trailingslashit( $path . DIRECTORY_SEPARATOR . $f );