PHP  
downloads | documentation | faq | getting help | | php.net sites | links 
search for in the  
previouscyrus_unbindctype_alnumnext
Last updated: Sun, 09 Jun 2002
view this page in Plain HTML | English | Brazilian Portuguese | Czech | Dutch | Finnish | French | Hungarian | Italian | Japanese | Korean | Polish | Romanian | Russian | Spanish | Turkish

XVI. Character type functions

Einf�hrung

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.

Anforderungen

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

Installation

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.

Laufzeit Konfiguration

Diese Erweiterung definiert keine Konfigurationseinstellungen.

Resource Typen

Diese Erweiterung definiert keine Resource-Typen.

Vordefinierte Konstanten

Diese Erweiterung definiert keine Konstanten.

Inhaltsverzeichnis
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: Sun, 09 Jun 2002
show source | credits | stats | mirror sites:  
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by:
Last updated: Sat Jun 29 12:03:35 2002 CEST