PHP: Character type functions - Manual
PHP  
downloads | documentation | faq | getting help | | php.net sites | links 
search for in the  
previouscyrus_unbindctype_alnumnext
Last updated: Tue, 09 Jul 2002
view this page in Printer friendly version | English | Brazilian Portuguese | Czech | Dutch | Finnish | French | German | Italian | Japanese | Korean | Polish | Romanian | Russian | Spanish | Turkish

XVI. Character type functions

Bevezet�s

The functions provided by this extension check whether a character or string falls into a certain character class according to the current locale (see also setlocale()).

When called with an integer argument these functions behave exactly like their C counterparts from "ctype.h".

When called with a string argument they will check every character in the string and will only return TRUE if every character in the string matches the requested criteria.

Passing anything else but a string or integer will return FALSE immediately.

K�vetelm�nyek

None besides functions from the standard C library which are always available.

Telep�t�s

Beginning with PHP 4.2.0 these functions are enabled by default. For older versions you have to configure and compile PHP with --enable-ctype.

Fut�sidej� be�ll�t�sok

Ez a kiterjeszt�s semmilyen konfigur�ci�s be�ll�t�sokat nem defini�l.

Er�forr�s t�pusok

Ez a kiterjeszt�s semmilyen er�forr�s t�pust nem defini�l.

El�re defini�lt �lland�k

Ez a kiterjeszt�s semmilyen konstans �rt�ket nem defini�l.

Tartalom
ctype_alnum -- Check for alphanumeric character(s)
ctype_alpha -- Check for alphabetic character(s)
ctype_cntrl -- Check for control character(s)
ctype_digit -- Check for numeric character(s)
ctype_graph -- Check for any printable character(s) except space
ctype_lower -- Check for lowercase character(s)
ctype_print -- Check for printable character(s)
ctype_punct --  Check for any printable character which is not whitespace or an alphanumeric character
ctype_space -- Check for whitespace character(s)
ctype_upper -- Check for uppercase character(s)
ctype_xdigit --  Check for character(s) representing a hexadecimal digit
User Contributed Notes
Character type functions
add a note about notes

06-May-2001 12:25

This manpage mentions that these functions are in PHP 4.0.4+ but it
neglects to mention the fact that php must be configured with the
--enable-ctype directive for it to work.


15-Aug-2001 12:22

Its not a perfect solution, but if you're can't or don't want to use the
ctype functions, you can test to see if something is an integer by doing
something like this:

if ( $var != "0" && $var / 1 == 0 ) { }

it seems redundant, but you're checking to be sure that $var is not the string representation of 0 first, and then finding out if $var is divisible by itself.


26-Nov-2001 07:22

better way than

if ( $var != "0" && $var / 1 == 0 ) { }

is

if ( $var == (int) $var ) { }

faster and simpler :) you may want === instead, thats upto you but then
you'd be better doing an is_long on the var

add a note about notes
previouscyrus_unbindctype_alnumnext
Last updated: Tue, 09 Jul 2002
show source | credits | stats | mirror sites:  
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by:
Last updated: Thu Jul 11 00:19:09 2002 CEST