Use array_map to easily delete files and directories in PHP,
Without further ado, let’s just paste the code. This article embodies simplicity
Copy code The code is as follows:
//Delete all empty directories under the directory
array_map('rmdir', glob('*', GLOB_ONLYDIR));
//Delete all files in the directory
array_map('unlink', array_filter(glob('*'), 'is_file'));
Use array_map to implement array_column function:
Copy code The code is as follows:
$data = array(
array(
'a' => 'first a',
'b' => 'first b'
),
array(
'a' => 'second a',
'b' => 'second b'
)
);
$array_column = array_map(function($element){
Return $element['a'];
}, $data);
print_r($array_column);
http://www.bkjia.com/PHPjc/902775.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/902775.htmlTechArticleUse array_map to simply delete files and directories in PHP. Without further ado, just paste the code. This article embodies simplicity. Copy the code. The code is as follows: php //Delete all in the directory...