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/