Gossamer Forum
Quote Reply
PHP Issue
Hey everybody.. been awhile since I got a chance to do any programming so of course, when out of the loop, you forget things.

I've recently been trying to separate some articles into specific categories. So far all is well, except!

I added a ":" into my array after each returned value so that I could explode the line and get each value separate. Now my last value has the : in it. eg.

Holidays, Bible Verses, Ellen White Material, Images :

I want to run a command to remove the colon and space at the end of this variable. Anyone know how I can go about doing that?

I think rtrim() only gets rid of whitespace, does it not?
Quote Reply
Re: [JoFrRi] PHP Issue In reply to
I was just playing with rtrim more and I think it worked...

$category[$cat_count - 1] = rtrim($category[$cat_count - 1], " : ");
Quote Reply
Re: [JoFrRi] PHP Issue In reply to
...or something like this may work;

Code:
$value = preg_replace('/\:$/','',$value);

My PHP is a little rusty too ... but I *think* that will work :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] PHP Issue In reply to
Thanks Andy, as usual still, the best man to reply!