The if (file_exists($file)) approach is a better good programming practice than suppressing the error with @. This make a code more readable, maintainable, and let you handle errors in a better way.
saludos, On Fri, Mar 27, 2009 at 9:04 AM, Daniel C. <[email protected]> wrote: > On Fri, Mar 27, 2009 at 9:40 AM, Kevin <[email protected]> wrote: > > "Error suppression is slow. This is because PHP dynamically changes > > error_reporting to 0 before executing the suppressed statement, then > > immediately changes it back. This is expensive." > > Cool, I didn't know that. > > > Using error suppression is always a bad thing. It makes debugging in the > > future much more difficult. If you want to include only files that exist > > just wrap it in an if ( file_exists($file) ). This makes the code much > more > > clearer [sic] and you don't sacrifice missing other potential errors that > > include_once might throw. > > Aside from the slowness, I don't see how the two are different. > Either way you're ensuring that include_once doesn't screw up your > program. > > -Dan > > _______________________________________________ > > UPHPU mailing list > [email protected] > http://uphpu.org/mailman/listinfo/uphpu > IRC: #uphpu on irc.freenode.net > _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
