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-punct.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-punct.php',
   
1 => 'ctype_punct',
  ),
 
'up' =>
  array (
   
0 => 'ref.ctype.php',
   
1 => 'Ctype Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.ctype-print.php',
   
1 => 'ctype_print',
  ),
 
'next' =>
  array (
   
0 => 'function.ctype-space.php',
   
1 => 'ctype_space',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.ctype-punct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ctype_punct</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.4, PHP 5)</p><p class="refpurpose"><span class="refname">ctype_punct</span> &mdash; <span class="dc-title">
   Check for any printable character which is not whitespace or an
   alphanumeric character
  </span></p>

 </div>

 <a name="function.ctype-punct.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_punct</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>
, are punctuation character.
  </p>
 </div>


 <a name="function.ctype-punct.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-punct.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>
 
   is printable, but neither letter, digit or blank, <b><tt class="constant">FALSE</tt></b> otherwise.
  </p>
 </div>


 <a name="function.ctype-punct.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_punct()</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">'ABasdk!@!$#'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'!@&nbsp;#&nbsp;$'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'*&amp;$()'</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">$testcase</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">ctype_punct</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">$testcase</span><span style="color: #DD0000">&nbsp;consists&nbsp;of&nbsp;all&nbsp;punctuation.\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">$testcase</span><span style="color: #DD0000">&nbsp;does&nbsp;not&nbsp;consist&nbsp;of&nbsp;all&nbsp;punctuation.\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 ABasdk!@!$# does not consist of all punctuation.
The string !@ # $ does not consist of all punctuation.
The string *&amp;$() consists of all punctuation.
</pre></div>
    </div>
   </div><p>
  </p>
 </div>


 <a name="function.ctype-punct.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>
   </ul><p>
  </p>
 </div>

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