Documented this previously undocumented feature.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@164018 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jeremy S. Johnstone 2004-07-22 16:13:36 +00:00
parent c17b7c09eb
commit cb2ed3b1ec

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry id="function.php-check-syntax">
<refnamediv>
<refname>php_check_syntax</refname>
@ -14,9 +14,47 @@
<methodparam><type>string</type><parameter>file_name</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>error_message</parameter></methodparam>
</methodsynopsis>
<simpara>
The <function>php_check_syntax</function> function performs a syntax (lint) check
on the specified <parameter>filename</parameter> testing for scripting errors.
</simpara>
<simpara>
If the second parameter is passed, the function will return the error messages from the syntax
check. This parameter must be passed by reference.
</simpara>
<para>
The following example shows how this function can be used.
<example>
<title><function>php_check_syntax</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
&warn.undocumented.func;
$error_message = "";
$filename = "./test.php";
if(!php_check_syntax($filename, &$error_message)) {
printf("Errors were found in the file %s:\n\n%s\n", $filename, $error_message);
}
else {
printf("The file %s contained no syntax errors.", $filename);
}
?>
]]>
</programlisting>
<simpara>
The output of the above script could look something like this:
</simpara>
<screen role="html">
<![CDATA[
Errors were found in the file ./tests.php:
parse error, unexpected T_STRING in /tmp/tests.php on line 81
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>