Jump to content

[SOLVED] Srtip off end of string Preg_replace


l!m!t

Recommended Posts

Hi - I hope someone can help me with this.

 

I am trying to strip off the last value from the last underscore

 

I seem to only be able to get the first underscore on. I just want the last underscore removed, so..

12_13_45_99

would be

12_13_45

 

Basically anything from the last underscore removed.

 

$new_cat= preg_replace("/_(.*)/i","",'12_13_45_99'); 

 

Any help would be great.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.