* Thus wrote Fraser Campbell ([EMAIL PROTECTED]): > Hi, > > What is it about assertions that makes them unsuitable for production use?
- For one, if assert() eveluates code like eval() does, there is very poor performance hit using it and a lot of overhead just to do simple statements that can easily be caught with an if statement. - It isn't desined to replace the if statement. - And with the example used in the article mentioned: assert("ereg($regex, $email, $parts); /* Invalid email address: $email */"); If assert.active is off, your validation is never checked. A more appropriate use for assert() would to be to prevent a E_WARNING/E_ERROR to be thrown for the regex: assert('empty($email); /* email was empty */') if (!ereg($regex, $email, $parts) ) { ... So in the development and QA process if that condition ever arises, then it can be fixed. So when the code is in production, we are guaranteed that never will there be a 'E_WARNING: second paramter is empty' issued. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php