Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 5824

php-manual-en-7.2.11-1.mga7.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Check the PHP syntax of (and execute) the specified file</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.pack.html">pack</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.php-strip-whitespace.html">php_strip_whitespace</a></div>
 <div class="up"><a href="ref.misc.html">Misc. Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.php-check-syntax" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">php_check_syntax</h1>
  <p class="verinfo">(PHP 5 &lt; 5.0.5)</p><p class="refpurpose"><span class="refname">php_check_syntax</span> &mdash; <span class="dc-title">
   Check the PHP syntax of (and execute) the specified file
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.php-check-syntax-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>php_check_syntax</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$error_message</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   Performs a syntax (lint) check on the specified 
   <code class="parameter">filename</code> testing for scripting errors.
  </p>
  <p class="para">
   This is similar to using <strong class="command">php -l</strong> from the <a href="features.commandline.html" class="link">commandline</a> except that this
   function will execute (but not output) the checked
   <code class="parameter">filename</code>.
  </p>
  <p class="para">
   For example, if a function is defined in <code class="parameter">filename</code>,
   this defined function will be available to the file that executed 
   <span class="function"><strong>php_check_syntax()</strong></span>, but output from 
   <code class="parameter">filename</code> will be suppressed.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   
   <p class="para">
    For technical reasons, this function is deprecated and removed from PHP.
    Instead, use <em>php -l somefile.php</em> from the 
    <a href="features.commandline.html" class="link">commandline</a>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.php-check-syntax-parameters">
 <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">filename</code></dt>

     <dd>

      <p class="para">
       The name of the file being checked.
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">error_message</code></dt>

     <dd>

      <p class="para">
       If the <code class="parameter">error_message</code> parameter is used, it will
       contain the error message generated by the syntax check. 
       <code class="parameter">error_message</code> is passed by 
       <a href="language.references.html" class="link">reference</a>.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.php-check-syntax-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> if the lint check passed, and <strong><code>FALSE</code></strong> if the link check
   failed or if <code class="parameter">filename</code> cannot be opened.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.php-check-syntax-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>5.0.5</td>
       <td>
        This function was removed from PHP.
       </td>
      </tr>

      <tr>
       <td>5.0.3</td>
       <td>
        Calling <span class="function"><a href="function.exit.html" class="function">exit()</a></span> after 
        <span class="function"><strong>php_check_syntax()</strong></span> resulted in a Segfault.
       </td>
      </tr>

      <tr>
       <td>5.0.1</td>
       <td>
        <code class="parameter">error_message</code> is passed by reference.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.php-check-syntax-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">php -l somefile.php</pre>
</div>
   </div>
  </p>
  <p class="para">The above example will output
something similar to:</p>
  <p class="para">
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">PHP Parse error: unexpected T_STRING in /tmp/somefile.php on line 81</pre>
</div>
   </div>
  </p>    
 </div>


 <div class="refsect1 seealso" id="refsect1-function.php-check-syntax-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="function.include.html" class="function" rel="rdfs-seeAlso">include</a> - include</span></li>
    <li class="member"><span class="function"><a href="function.is-readable.html" class="function" rel="rdfs-seeAlso">is_readable()</a> - Tells whether a file exists and is readable</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.pack.html">pack</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.php-strip-whitespace.html">php_strip_whitespace</a></div>
 <div class="up"><a href="ref.misc.html">Misc. Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>