PHP/Data Type/Char — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 07:03, 26 мая 2010
Predefined Characters and Classes
Character Meaning
\a Beep
\n Newline character
\r Carriage return
\t Tab
\f Formfeed
\e Escape
\d Digit (same as [0-9])
\D Nondigit character (same as [^0-9])
\w Word character (same as [a-zA-Z0-9_])
\W Nonword character
\s White-space character (same as [ \t\n\r\f])
\S Non White-space character
\xX Hexadecimal digit
\cX Matches the corresponding control character
String char count
<?
$twister = "Peter Piper picked a peck of pickled peppers";
print("$twister<BR>");
$letter_array = count_chars($twister, 1);
while ($cell = each($letter_array)){
$letter = chr($cell["key"]);
$frequency = $cell["value"];
print("Character: "$letter"; frequency: $frequency<BR>");
}
?>