Re: RE: RFC: expectations/assertions

From: Date: Tue, 04 Feb 2014 21:47:02 +0000
Subject: Re: RE: RFC: expectations/assertions
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message


On 04/02/14 21:30, Yasuo Ohgaki wrote:
eval() works. php > assert(eval('FALSE;')); Warning: assert(): Assertion failed in php shell code on line 1 php > assert(eval('return FALSE;')); Warning: assert(): Assertion failed in php shell code on line 1 php > However, it does not solve inconsistency. PHP code has to be string. Writing PHP code as string is not fun thing to do ;)
That's not what I meant. At present, you do:
    assert($string);
And that string is evaluated. A closure would be faster. Though this is for debugging code, so I'm not sure it matters (though I, unlike some people, might like to use assertions in production code to make sure things fail early, fail often). -- Andrea Faulds http://ajf.me/

Thread (44 messages)

« previous php.internals (#72220) next »