Re: can i rely on ctype?

From: Date: Mon, 16 Jul 2007 07:40:31 +0000
Subject: Re: can i rely on ctype?
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-47513@lists.php.net to get a copy of this message
Hi, Deprecating ctype makes a lot of sense. I have a lot of code using PCRE with "/^\d*$/" to avoid the casting errors. It's also of limited utility in a multi-lingual setting - even though it is Locale aware. Having a unicode friendly char_is_* makes a huge amount of sense. Anyway, ctype doesn't like my name ;) on most English sites if its used. Paddy Pádraic Brady http://blog.astrumfutura.com http://www.patternsforphp.com ----- Original Message ---- From: Stefan Walk <stefan.walk@gmail.com> To: Alexey Borzov <borz_off@cs.msu.su> Cc: Lukas Kahwe Smith <mls@pooteeweet.org>; Christian Weiske <cweiske@cweiske.de>; pear-dev@lists.php.net Sent: Sunday, July 15, 2007 10:36:45 PM Subject: Re: [PEAR-DEV] can i rely on ctype? On 15/07/07, Alexey Borzov <borz_off@cs.msu.su> wrote: > That's a bit strange, since deprecating the extension that is currently enabled > by default is a pretty major change. I think getting the relevant info out of > Marcus and / or Andrei is in order... A pretty major change that makes perfect sense. When PHP6 is there, there are char_is_*-functions using ICU (the unicode library). Those functions do everything that ctype does in a more coherent way, example: swalk@itchy:~/programming/php/php6> ./php-unicode -r 'var_dump(ctype_digit(123));' bool(false) swalk@itchy:~/programming/php/php6> ./php-unicode -r 'var_dump(char_is_digit(123));' bool(true) So you don't have to explicitely cast to string anymore when you want to check that a value you got is either an integer or a string containing only an integer, which is more like string/int juggling works in the rest of php ... to summarize, you have new functions offering the same functionality and more, and have a cleaner API ... so the rational thing to do is deprecate the old functionality. It won't be gone, but folks should be made aware that better things are available. Regards, Stefan -- PEAR Development Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ____________________________________________________________________________________ Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7

« previous php.pear.dev (#47513) next »