php/mysql remove part of string and echo -


i've got simple set of strings:

abc_def

abc_1_def

i'm trying remove 1_ second string. 1 may character a-z0-9. suggestions or assistance?

something php:

function sup($string){    $string = explode("_", $string);     return count($string) > 2 ? $string[0]."_".$string[2] : $string; } 

or

function sup($string){     return preg_replace("/_.+_/", "_", $string); } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -