PHP
downloads | documentation | faq | getting help | mailing lists | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ctype_alnum> <Ctype
Last updated: Fri, 14 Nov 2008

view this page in

Ctype 関数

目次

  • ctype_alnum — 英数字かどうかを調べる
  • ctype_alpha — 英字かどうかを調べる
  • ctype_cntrl — 制御文字かどうかを調べる
  • ctype_digit — 数字かどうかを調べる
  • ctype_graph — 空白以外の印字可能な文字かどうかを調べる
  • ctype_lower — 小文字かどうかを調べる
  • ctype_print — 印字可能な文字かどうかを調べる
  • ctype_punct — 空白、英数字以外の出力可能な文字かどうかを調べる
  • ctype_space — 空白文字かどうか調べる
  • ctype_upper — 大文字かどうか調べる
  • ctype_xdigit — 16 進数を表す文字かどうかを調べる


add a note add a note User Contributed Notes
Ctype 関数
14-Oct-2006 04:44
In PHP versions before 4.4.1, ctype functions have a bug handling very large integers.
http://bugs.php.net/bug.php?id=34645
See Crimson's comment under ctype_digit, or this test code from the bug:
<?php
$id
= 394829384;
var_dump($id);
ctype_digit($id);
var_dump($id);
?>

Expected result:
----------------
int(394829384)
int(394829384)

Actual result:
--------------
int(394829384)
NULL

The fix is to cast it as a string:
<?php
ctype_digit
((string)$id);
?>
... or use a current version of PHP!
avarab at gmail dot com
03-Jan-2006 09:58
In case the ctype_*() functions aren't compiled in your PHP and you can't recompile for some reason (e.g. shared host) you can use the compatability functions from the MediaWiki project which use preg_* as a replacement[1], removing lines 2 and 3 in the source should make them suitable for usage elsewhere.

Shameless self-advertisement, but hey, we find them useful;)

1. A tinyurl because the submission script complained about long lines: http://tinyurl.com/7hz4l
1. The real url split up:
http://cvs.sourceforge.net/viewcvs.py/*checkout*/
wikipedia/phase3/includes/compatability/ctype.php

ctype_alnum> <Ctype
Last updated: Fri, 14 Nov 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites