Look for "/" in a string

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
mattmcb
Forum Commoner
Posts: 27
Joined: Sun Jan 25, 2004 3:34 pm

Look for "/" in a string

Post by mattmcb »

I've been searching around on php.net trying to find a method for finding "/" in a string. Basically, the date needs to be formatted a certain way before it can be inserted in the database.

This is for a WAP site and I need to return and error if the string does not contain two "/". Can anyone help?
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

look into [php_man]strings[/php_man] functions.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

[php_man]preg_match[/php_man]
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

[php_man]strstr[/php_man] This might also help, if you're looking for one character, I don't think full blown regex is the way to go as it really slows things down. Depends on what you need of course.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

I'd say [php_man]regex[/php_man] is a good solution.
Post Reply