PHP/Data Type/Char — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 10:03, 26 мая 2010
Predefined Characters and Classes
<source lang="html4strict">
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
</source>
String char count
<source lang="html4strict">
<?
$twister = "Peter Piper picked a peck of pickled peppers";
print("$twister
");
$letter_array = count_chars($twister, 1);
while ($cell = each($letter_array)){
$letter = chr($cell["key"]); $frequency = $cell["value"]; print("Character: "$letter"; frequency: $frequency
");
} ?>
</source>