Checking variable length

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iG9
Forum Commoner
Posts: 38
Joined: Fri Jul 18, 2008 2:11 pm

Checking variable length

Post by iG9 »

Apologies is this is obvious, but does anyone know a good function to check a variable's length? I'm trying to enforce my db's type constraints. Thanks in advance.
watson516
Forum Contributor
Posts: 198
Joined: Mon Mar 20, 2006 9:19 pm
Location: Hamilton, Ontario

Re: Checking variable length

Post by watson516 »

You can use strlen to check the length of strings.
iG9
Forum Commoner
Posts: 38
Joined: Fri Jul 18, 2008 2:11 pm

Re: Checking variable length

Post by iG9 »

Thanks man I'll give it a try.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Checking variable length

Post by requinix »

If you have the mbstring module installed (it's quite likely) I'd suggest mb_strlen instead.
Post Reply