Jump to content

echo part of variable?


JackW

Recommended Posts

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

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 by boen_robot
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...