bobbybobbertson
Programmer
I am a perl programmer trying to learn php. I saw this in some PHP code and would like to know what it means?
$directory_array[] = $file;
what are the brackets at the end of the 'directory_array' variable for? Actually, why are they empty?
HERE IS A BIGGER PIECE OF THE CODE, IF INTERESTED;
$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
$directory_array = array();
if ($dir = @dir($module_directory)) {
while ($file = $dir->read()) {
if (!is_dir($module_directory . $file)) {
if (substr($file, strrpos($file, '.')) == $file_extension) {
$directory_array[] = $file;
}
}
}
sort($directory_array);
$dir->close();
}
$directory_array[] = $file;
what are the brackets at the end of the 'directory_array' variable for? Actually, why are they empty?
HERE IS A BIGGER PIECE OF THE CODE, IF INTERESTED;
$file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
$directory_array = array();
if ($dir = @dir($module_directory)) {
while ($file = $dir->read()) {
if (!is_dir($module_directory . $file)) {
if (substr($file, strrpos($file, '.')) == $file_extension) {
$directory_array[] = $file;
}
}
}
sort($directory_array);
$dir->close();
}