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 #182678 is a reply to message #182672] Mon, 26 August 2013 16:15 Go to previous messageGo to previous message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma:
Senior Member
On 2013-08-25 4:19 PM, Christoph Michael Becker wrote:
> 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
>>
....
> 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)
> {

Agreed & understood.
>
> 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.
>

Wish my code snippet hadn't been snipped, because it did work, without
the parens issue.
$var was intended to be used in some places and $var[n] in others
but I don't.
That said, I'll have a relook again as you might have a point; alnum
still isn't giveing me what I need and I've assued it's been because of
a necessary space in the string, which I thought I'd taken proper care of.

Thanks for the prods.

Twayne`
[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: Wed Nov 27 10:48:19 GMT 2024

Total time taken to generate the page: 0.04888 seconds