JackW Posted August 27, 2006 Share Posted August 27, 2006 I have a row in my data base that contains information like 10 Oct. It is all in one row and I need to echo just the three letters in one area and all of it in another. I am sure there is a way but can't seem to remember where I found it.Your help will be appreciated.Jack Link to comment Share on other sites More sharing options...
SirPaladin Posted August 27, 2006 Share Posted August 27, 2006 There are some string functions for you to use. Search in the PHP manual. I don`t remember the names of the functions. :)EDIT: Try here. Link to comment Share on other sites More sharing options...
boen_robot Posted August 27, 2006 Share Posted August 27, 2006 (edited) I'm no expert with PHP, but the first thing that comes to my mind is a regular expression: ereg("([0-9]*) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)", "10 Oct", $ArrayThatWillContainEachPart); or perhaps the token-get-all() function: $tokens = token_get_all('10 Oct'); Edited August 27, 2006 by boen_robot Link to comment Share on other sites More sharing options...
SirPaladin Posted August 27, 2006 Share Posted August 27, 2006 I'm no expert with PHP, but the first thing that comes to my mind is a regular expression:ereg("([0-9]) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)", "10 Oct", $ArrayThatWillContainEachPart); or perhaps thetoken-get-all() function: $tokens = token_get_all('10 Oct'); Since the months are all 3-letter, a string modifier using substr() would be better IMHO. But I never tried it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now