[TYPO3-core] RFC: uninitialized variables code cleanup

Wolfgang Klinger wolfgang at stufenlos.net
Thu Jan 19 10:53:19 CET 2006


 *hiya!*

 On Thu, 19 Jan 2006, René Fritz wrote the following:
> Here I init $matches inline which might be not so nice but occurs with 
> preg_match and ereg calls only and is Ok in my eyes. We can do it this way if 
> you prefer:
> 
> $matches=array();
> if (preg_match('/xyz/', $string, $matches)

 +1 

 My practice is that I initialize only arrays and boolean variables,
 I rarely set a string to '' (if not really required) and I 
 suggest to use the same practice here (as PHP has weak typing anyway
 and this only clutters up code IMHO).

 Another change in connection with this is to return 'true' or 'false' 
 explicitly where a boolean return value is expected
 (see my mail about the matchcondition patch yesterday).


 kind regards
 Wolfgang




More information about the TYPO3-team-core mailing list