mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
c17b7c09eb
commit
cb2ed3b1ec
1 changed files with 40 additions and 2 deletions
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue