FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » CTYPE
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: CTYPE [message #182672 is a reply to message #182669] Sun, 25 August 2013 20:19 Go to previous messageGo to previous message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma:
Senior Member
Twayne wrote:

> On 2013-08-25 2:38 PM, J.O. Aho wrote:
>> On 25/08/13 19:51, Twayne wrote:
>>
>> Simple maths will show your error, lets count your opening parentheses
>>
>> if (ctype_alnum(str_split($zip,1)) {
>> 1 2 3
>
> So Richard noted also. I even fired up another editor that shows parens
> et al by simply hoering a mouse over the tag. Damned if I didn't see it
> there either!

If you're having problems keeping *nesting* parens balanced, you might
consider to avoid them. The code above could be written this way:

$characters = str_split($zip, 1);
$is_alphanumeric = ctype_alnum($characters);
if ($is_aphanumeric)
{

This has the additional advantage that it eases debugging.

BTW: The code won't work, as ctype_alnum() expects a string, but
str_split() returns an array.

--
Christoph M. Becker
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: korean character sets
Next Topic: Android app Developers requirements
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 07 00:11:55 GMT 2024

Total time taken to generate the page: 0.13049 seconds