On Wed, Nov 19, 2003 at 03:18:34PM -0500, Ilia Alshanetsky wrote :
> On November 19, 2003 02:40 pm, Markus Fischer wrote:
> > bool php_check_syntax($filename [, &$error_message]);
>
> I'll need to look at the code, it should be possible to do. Although I'd
> prefer to have it return the error rather then return it by reference as an
> optional argument.
I understand. I might think it's just safer so one can assume the
return value (bool) just gives information whether it works or not
and the error message itself is a bonus.
if (!php_check_syntax("myscript.php", &$error_message) {
die ( "myscript.php didn't validaet: $error_message");
}
vs.
if (strlen($error_message = php_check_syntax("myscript.php")) > 0) {
die ( "myscript.php didn't validaet: $error_message");
}
I find the former a somewhat cleaner approach than the latter; or
maybe it's just me.
- Markus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php