RE: [PHP] Variable name declarations?

From: Date: Sat, 14 Jul 2001 21:29:19 +0000
Subject: RE: [PHP] Variable name declarations?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57906@lists.php.net to get a copy of this message
> function sum_array( $input_array ) > { > var $index; > var $sum = 0; > > for( $index = 0; $index < count( $input_array ); $index++ ) > $sum += $input_array[ $index ]; > > return $sum; > } The array variable issue has indeed bitten me a couple of times, so now all my arrays are called $<something>_arr. It would nice to introduce more runtime checking of array types and complaints in case non-array values are used in functions. But otherwise the strong type checking will just cause more problems and more overhead with calls. I don't know if the example above will help that much, but you could already write similar code in functions to make sure that the values are declared on top, to make things clearer. --Kent

« previous php.general (#57906) next »