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

search for in the

ctype_alnum> <ctype
Last updated: Fri, 03 Oct 2008

view this page in

Fonctions Ctype

Sommaire

  • ctype_alnum — Vérifie qu'une chaîne est alphanumérique
  • ctype_alpha — Vérifie qu'une chaîne est alphabétique
  • ctype_cntrl — Vérifie qu'un caractère est un caractère de contrôle
  • ctype_digit — Vérifie qu'une chaîne est un entier
  • ctype_graph — Vérifie qu'une chaîne est imprimable
  • ctype_lower — Vérifie qu'une chaîne est en minuscules
  • ctype_print — Vérifie qu'une chaîne est imprimable
  • ctype_punct — Vérifie qu'une chaîne contient de la ponctuation
  • ctype_space — Vérifie qu'une chaîne n'est faite que de caractères blancs
  • ctype_upper — Vérifie qu'une chaîne est en majuscules
  • ctype_xdigit — Vérifie qu'un caractère représente un nombre hexadécimal


add a note add a note User Contributed Notes
Fonctions Ctype
14-Oct-2006 10: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 03: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, 03 Oct 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites