damianb123
asked on
Explode variable with commas to separate lines
Hi,
I have a value which is pulled from a MySql query which looks like this:
$rows1['gphours']
This value contains text like this:
Monday 9-5, Tuesday 10-4, Wednesday 9-4
What i need to do is perform an explode or implode and add a <br>, so the output looks like:
Monday 9-5
Tuesday 10-4
Wednesday 9-4
I can't think how to get it going....
Any help much appreciated.
I have a value which is pulled from a MySql query which looks like this:
$rows1['gphours']
This value contains text like this:
Monday 9-5, Tuesday 10-4, Wednesday 9-4
What i need to do is perform an explode or implode and add a <br>, so the output looks like:
Monday 9-5
Tuesday 10-4
Wednesday 9-4
I can't think how to get it going....
Any help much appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect, did the job nicely.... Thanks - I thought I was nearly there, it's been a long day, so thanks for your quick response.
Thanks for points but I was sure you would choose rjohnsonjr solutions: simpler, quicker and definitely more intelligent. My solution is intricate without reason. Please, consider to request attention to the moderator using the link immediately below the question box and award points to rjohnsonjr: he deserves points and future members could find my bad solution instead of the good one :-)
I would choose the str_replace() method also.
Open in new window