downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.ctype-space.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.ctype.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.ctype-space.php',
   
1 => 'ctype_space',
  ),
 
'up' =>
  array (
   
0 => 'ref.ctype.php',
   
1 => 'Ctype Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.ctype-punct.php',
   
1 => 'ctype_punct',
  ),
 
'next' =>
  array (
   
0 => 'function.ctype-upper.php',
   
1 => 'ctype_upper',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.ctype-space" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ctype_space</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5)</p><p class="refpurpose"><span class="refname">ctype_space</span> &mdash; <span class="dc-title">Check for whitespace character(s)</span></p>

 </div>

 <a name="function.ctype-space.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><b>ctype_space</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$text</tt></span>
   )</div>

  <p class="para rdfs-comment">
   Checks if all of the characters in the provided string,
   <i><tt class="parameter">text</tt></i>
, creates whitespace.
  </p>
 </div>


 <a name="function.ctype-space.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">text</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The tested string.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.ctype-space.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <b><tt class="constant">TRUE</tt></b> if every character in <i><tt class="parameter">text</tt></i>
 
   creates some sort of white space, <b><tt class="constant">FALSE</tt></b> otherwise. Besides the
   blank character this also includes tab, vertical tab, line feed,
   carriage return and form feed characters.
  </p>
 </div>


 <a name="function.ctype-space.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 A <b>ctype_space()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$strings&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'string1'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"\n\r\t"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'string2'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"\narf12"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'string3'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'\n\r\t'</span><span style="color: #007700">);<br />foreach&nbsp;(</span><span style="color: #0000BB">$strings&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$name&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$testcase</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">ctype_space</span><span style="color: #007700">(</span><span style="color: #0000BB">$testcase</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;string&nbsp;'</span><span style="color: #0000BB">$name</span><span style="color: #DD0000">'&nbsp;consists&nbsp;of&nbsp;all&nbsp;whitespace&nbsp;characters.\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"The&nbsp;string&nbsp;'</span><span style="color: #0000BB">$name</span><span style="color: #DD0000">'&nbsp;does&nbsp;not&nbsp;consist&nbsp;of&nbsp;all&nbsp;whitespace&nbsp;characters.\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents para"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
The string &#039;string1&#039; consists of all whitespace characters.
The string &#039;string2&#039; does not consist of all whitespace characters.
The string &#039;string3&#039; does not consist of all whitespace characters.
</pre></div>
    </div>
   </div><p>
  </p>
 </div>


 <a name="function.ctype-space.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.ctype-cntrl.php" class="function" rel="rdfs-seeAlso">ctype_cntrl()</a> - Check for control character(s)</li>
    <li class="member"><a href="function.ctype-graph.php" class="function" rel="rdfs-seeAlso">ctype_graph()</a> - Check for any printable character(s) except space</li>
    <li class="member"><a href="function.ctype-punct.php" class="function" rel="rdfs-seeAlso">ctype_punct()</a> - Check for any printable character which is not whitespace or an
   alphanumeric character</li>
   </ul><p>
  </p>
 </div>

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites