@CharlesFeb 17.2006 — #This noob wants to know, Is [font=monospace]if(count($files) > 0)[/font] really necessary? Can it be better written as [font=monospace]if(count($files))[/font]?
@NogDogFeb 17.2006 — #This noob wants to know, Is [font=monospace]if(count($files) > 0)[/font] really necessary? Can it be better written as [font=monospace]if(count($files))[/font]?[/QUOTE] Function-wise either would work. Peformance-wise, you might save a micro-second or two without the > comparison (I'm just speculating, I have no empirical evidence). As I was thinking "If we got 1 or more files, then we're OK," and not thinking boolean, my fingers typed out a comparison instead of a true/false test. So basically I could live with either idiom, and don't consider either to necessarily be "better."
@bokehFeb 18.2006 — #This noob wants to know, Is [font=monospace]if(count($files) > 0)[/font] really necessary? Can it be better written as [font=monospace]if(count($files))[/font]?[/QUOTE]It's just good practice to check the output of functions. Some functions return [I]0[/I] on success and others return values other than [I]0[/I] or [I]false[/I] on failure.