Re: assert()

From: Date: Sat, 20 Jul 2002 09:35:04 +0000
Subject: Re: assert()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-86040@lists.php.net to get a copy of this message
On Sat, Jul 20, 2002 at 10:31:39AM +0900, Yasuo Ohgaki wrote: > 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. hmm, it actually uses zend_eval_string(). not sure what's wrong. have no time to dig into this though. re, tc

« previous php.dev (#86040) next »