Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #10631
| From | Twayne <nobody@spamcop.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: CTYPE |
| Date | 2013-08-26 12:15 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <kvfuvg$ik1$1@speranza.aioe.org> (permalink) |
| References | <kvdg6l$cni$1@speranza.aioe.org> <b7v18bFpg13U1@mid.individual.net> <kvdlrv$si2$1@speranza.aioe.org> <521a66d0$0$9517$9b4e6d93@newsspool1.arcor-online.net> |
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`
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
CTYPE Twayne <nobody@spamcop.net> - 2013-08-25 13:51 -0400
Re: CTYPE Richard Yates <richard@yatesguitar.com> - 2013-08-25 11:21 -0700
Re: CTYPE Twayne <nobody@spamcop.net> - 2013-08-25 15:00 -0400
Re: CTYPE Richard Yates <richard@yatesguitar.com> - 2013-08-25 12:05 -0700
Re: CTYPE "J.O. Aho" <user@example.net> - 2013-08-25 20:38 +0200
Re: CTYPE Twayne <nobody@spamcop.net> - 2013-08-25 15:28 -0400
Re: CTYPE Richard Yates <richard@yatesguitar.com> - 2013-08-25 13:16 -0700
Re: CTYPE Twayne <nobody@spamcop.net> - 2013-08-26 11:49 -0400
Re: CTYPE Christoph Michael Becker <cmbecker69@arcor.de> - 2013-08-25 22:19 +0200
Re: CTYPE Twayne <nobody@spamcop.net> - 2013-08-26 12:15 -0400
Re: CTYPE Fiver <numeralfive@gmail.com> - 2013-08-25 22:42 +0200
Re: CTYPE Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-26 10:25 +0200
Re: CTYPE The Natural Philosopher <tnp@invalid.invalid> - 2013-08-26 09:29 +0100
Re: CTYPE Twayne <nobody@spamcop.net> - 2013-08-26 12:37 -0400
Re: CTYPE Norman Peelman <npeelman@cfl.rr.com> - 2013-08-25 15:11 -0400
Re: CTYPE Tim Streater <timstreater@greenbee.net> - 2013-08-25 23:04 +0100
Re: CTYPE THREAD RESOLVED Twayne <nobody@spamcop.net> - 2013-08-25 15:35 -0400
Re: CTYPE THREAD RESOLVED Fiver <numeralfive@gmail.com> - 2013-08-26 20:07 +0200
Re: CTYPE THREAD RESOLVED The Natural Philosopher <tnp@invalid.invalid> - 2013-08-26 20:19 +0100
Re: CTYPE THREAD RESOLVED Fiver <numeralfive@gmail.com> - 2013-08-26 22:51 +0200
Re: CTYPE THREAD RESOLVED Jerry Stuckle <jstucklex@attglobal.net> - 2013-08-26 16:57 -0400
Re: CTYPE THREAD RESOLVED Twayne <nobody@spamcop.net> - 2013-08-27 17:20 -0400
Re: CTYPE THREAD RESOLVED Jerry Stuckle <jstucklex@attglobal.net> - 2013-08-27 19:47 -0400
Re: CTYPE THREAD RESOLVED Tim Streater <timstreater@greenbee.net> - 2013-08-26 22:07 +0100
Re: CTYPE THREAD RESOLVED Twayne <nobody@spamcop.net> - 2013-08-28 08:49 -0400
Re: CTYPE THREAD RESOLVED Twayne <nobody@spamcop.net> - 2013-08-27 17:18 -0400
csiph-web