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 >= 4.0.4, PHP 5)</p><p class="refpurpose"><span class="refname">ctype_punct</span> — <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"><?php<br />$strings </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'ABasdk!@!$#'</span><span style="color: #007700">, </span><span style="color: #DD0000">'!@ # $'</span><span style="color: #007700">, </span><span style="color: #DD0000">'*&$()'</span><span style="color: #007700">);<br />foreach (</span><span style="color: #0000BB">$strings </span><span style="color: #007700">as </span><span style="color: #0000BB">$testcase</span><span style="color: #007700">) {<br /> if (</span><span style="color: #0000BB">ctype_punct</span><span style="color: #007700">(</span><span style="color: #0000BB">$testcase</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"The string </span><span style="color: #0000BB">$testcase</span><span style="color: #DD0000"> consists of all punctuation.\n"</span><span style="color: #007700">;<br /> } else {<br /> echo </span><span style="color: #DD0000">"The string </span><span style="color: #0000BB">$testcase</span><span style="color: #DD0000"> does not consist of all punctuation.\n"</span><span style="color: #007700">;<br /> }<br />}<br /></span><span style="color: #0000BB">?></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 *&$() 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(); ?>