Re: validate_file() and strip_file()
| From: | Markus Fischer | Date: | Thu, 20 Nov 2003 05:51:51 +0000 |
| Subject: | Re: validate_file() and strip_file() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-5601@lists.php.net to get a copy of this message | ||
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