assert()
| From: | Yasuo Ohgaki | Date: | Sat, 20 Jul 2002 01:31:39 +0000 |
| Subject: | assert() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-86035@lists.php.net to get a copy of this message | ||
We can write assert code as a function,
==========
[yohgaki@dev DEV]$ php
<?php
function t() {
return false;
}
assert('t();');
?>
PHP Warning: Assertion "t();" failed in - on line 7
==========
but we cannot write assert code as string.
==========
[yohgaki@dev DEV]$ php
<?php
assert('if (1) return false;');
?>
PHP Parse error: parse error in -(2) : assert code on line 1
==========
Current assert() behavior is the same as passing function
name as parameter.
Any reason why? Shouldn't it behave like eval()? or
make assert() accept a function.
--
Yasuo Ohgaki