jsjohnst Thu Jul 22 12:13:36 2004 EDT
Modified files:
/phpdoc/en/reference/misc/functions php-check-syntax.xml
Log:
Documented this previously undocumented feature.
http://cvs.php.net/diff.php/phpdoc/en/reference/misc/functions/php-check-syntax.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/misc/functions/php-check-syntax.xml
diff -u phpdoc/en/reference/misc/functions/php-check-syntax.xml:1.1
phpdoc/en/reference/misc/functions/php-check-syntax.xml:1.2
--- phpdoc/en/reference/misc/functions/php-check-syntax.xml:1.1 Sun May 2 11:46:21
2004
+++ phpdoc/en/reference/misc/functions/php-check-syntax.xml Thu Jul 22 12:13:36
2004
@@ -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>