Problem with Arrays?

From: Date: Sat, 22 Feb 2003 12:46:26 +0000
Subject: Problem with Arrays?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-136618@lists.php.net to get a copy of this message
I ran into something interesting & the only thing I can figure out is that functions won't use any variables other than globals, those past to the function, or those created inside the function? here's what I had that didn't print anything other than 3 blank lines for this section of code - $byteSize[0] = "bytes"; $byteSize[1] = "kb"; $byteSize[2] = "mb"; function getMaxSize( $maxSize ) { echo $byteSize[0] . "<br/>\n"; echo $byteSize[1] . "<br/>\n"; echo $byteSize[2] . "<br/>\n"; .... } but, if I put the array inside the function it would actually work - function getMaxSize( $maxSize ) { $byteSize[0] = "bytes"; $byteSize[1] = "kb"; $byteSize[2] = "mb"; echo $byteSize[0] . "<br/>\n"; echo $byteSize[1] . "<br/>\n"; echo $byteSize[2] . "<br/>\n"; .... } what's up with this? Maybe I'm just up way to late again. Patrick

« previous php.general (#136618) next »