ctype_space

(PHP 4 >= 4.0.4, PHP 5, PHP 7)

ctype_space锟斤拷锟秸帮拷锟街凤拷锟斤拷锟�

说锟斤拷

ctype_space ( string $text ) : bool

锟斤拷锟斤拷峁╋拷锟� string 锟斤拷 text 锟斤拷锟斤拷锟斤拷址锟斤拷欠锟斤拷锟斤拷锟秸白★拷

锟斤拷锟斤拷

text

锟斤拷要锟斤拷锟斤拷锟皆碉拷锟街凤拷锟斤拷锟斤拷

锟斤拷锟斤拷值

锟斤拷锟� text 锟斤拷锟斤拷锟矫匡拷锟斤拷址锟斤拷锟斤拷毡锟绞碉拷锟斤拷锟斤拷锟斤拷时锟斤拷锟斤拷某锟斤拷锟斤拷式锟侥空白o拷锟酵凤拷锟斤拷 TRUE 锟斤拷锟斤拷锟津返伙拷 FALSE 锟斤拷 锟斤拷锟剿空帮拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷直锟狡憋拷锟斤拷锟斤拷锟斤拷蟹锟斤拷锟斤拷爻锟斤拷突锟揭筹拷址锟斤拷锟�

锟斤拷锟斤拷

Example #1 一锟斤拷 ctype_space() 锟斤拷锟斤拷

<?php
$strings 
= array('string1' => "\n\r\t"'string2' => "\narf12"'string3' => '\n\r\t');
foreach (
$strings as $name => $testcase) {
    if (
ctype_space($testcase)) {
        echo 
"The string '$name' consists of all whitespace characters.\n";
    } else {
        echo 
"The string '$name' does not consist of all whitespace characters.\n";
    }
}
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

The string 'string1' consists of all whitespace characters.
The string 'string2' does not consist of all whitespace characters.
The string 'string3' does not consist of all whitespace characters.

注锟斤拷

Note:

锟斤拷锟斤拷锟斤拷锟揭伙拷锟� -128 锟斤拷 255 之锟斤拷(锟斤拷)锟斤拷锟斤拷锟斤拷, 锟斤拷锟结被锟斤拷锟斤拷为锟斤拷值锟斤拷应锟斤拷ASCII锟街凤拷 (锟斤拷值锟斤拷锟斤拷锟斤拷 256 锟斤拷支锟斤拷锟斤拷展ASCII锟街凤拷). 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟结被锟斤拷锟斤拷为锟斤拷值锟斤拷应锟斤拷十锟斤拷锟斤拷锟街凤拷锟斤拷.

锟轿硷拷

  • ctype_cntrl() - 锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟�
  • ctype_graph() - 锟斤拷锟缴达拷印锟街凤拷锟斤拷锟斤拷猓拷崭锟斤拷锟斤拷
  • ctype_punct() - 锟斤拷锟缴达拷印锟斤拷锟街凤拷锟角诧拷锟角诧拷锟斤拷锟斤拷锟秸白★拷锟斤拷锟街猴拷锟斤拷母