Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array[]

Status
Not open for further replies.

bobbybobbertson

Programmer
Nov 9, 2001
119
US
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();
}
 
That expression pushes the value to the end of the array. ______________________________________________________________________
Never forget that we are
made of the stuff of stars
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top