|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-02-11 08:31 UTC] chris dot dickinson at web dot de
Description: ------------ Hi, On your page http://ch2.php.net/manual/en/function.trigger-error.php you give only this example <?php if (assert($divisor == 0)) { trigger_error("Cannot divide by zero", E_USER_ERROR); } ?> It seems badly chosen. If $divisor is 0 then the assertion succeeds, when actually you would probably not want $divisor to be 0 (!). If $divisor is anything else but 0, the assertion will fail and give you an error message. I got: "Warning: assert() [function.assert]: Assertion failed in ..." Reproduce code: --------------- --- From manual page: function.trigger-error#Examples --- PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 09:00:02 2026 UTC |
Maybe the author wanted to write something like the following? : <?php if ($divisor == 0) { trigger_error("Cannot divide by zero", E_USER_ERROR); } ?> or <?php if ( ! assert($divisor != 0)) { trigger_error("Cannot divide by zero", E_USER_ERROR); } ?>