<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.misc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.php-strip-whitespace.php',
    1 => 'php_strip_whitespace',
    2 => '返回删除注释和空格后的PHP源码',
  ),
  'up' => 
  array (
    0 => 'ref.misc.php',
    1 => '杂项 函数',
  ),
  'prev' => 
  array (
    0 => 'function.pack.php',
    1 => 'pack',
  ),
  'next' => 
  array (
    0 => 'function.sapi-windows-cp-conv.php',
    1 => 'sapi_windows_cp_conv',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/misc/functions/php-strip-whitespace.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.php-strip-whitespace" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">php_strip_whitespace</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">php_strip_whitespace</span> &mdash; <span class="dc-title">返回删除注释和空格后的PHP源码</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.php-strip-whitespace-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>php_strip_whitespace</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   返回删除注释和空格后 <code class="parameter">filename</code> 的PHP源码。这对实际代码数量和注释数量的对比很有用。
   此函数与 <a href="features.commandline.php" class="link">命令行</a> 下执行 <strong class="command">php -w</strong> 相似。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.php-strip-whitespace-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       PHP文件的路径。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.php-strip-whitespace-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   在成功时返回过滤后的代码，或者在失败时返回空字符串。
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <p class="para">
    此函数遵守 <a href="ini.core.php#ini.short-open-tag" class="link">short_open_tag</a> ini 指令的值。
   </p>
  </p></blockquote>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.php-strip-whitespace-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>php_strip_whitespace()</strong></span> 的例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// PHP comment here<br /><br />/*<br /> * Another PHP comment<br /> */<br /><br /></span><span style="color: #007700">echo        </span><span style="color: #0000BB">php_strip_whitespace</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// Newlines are considered whitespace, and are removed too:<br /></span><span style="color: #0000BB">do_nothing</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>以上示例会输出：</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">&lt;?php
 echo php_strip_whitespace(__FILE__); do_nothing(); ?&gt;</pre>
</div>
    </div>
    <div class="example-contents"><p>
     可以注意到PHP的注释已不存在，成为第一个echo语句前的换行和空格。
    </p></div>
   </div>
  </p>
 </div>


</div><?php manual_footer($setup); ?>