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

Multilayer CSV to filtered excel -

Listboxes in c# -

ios - Why must I define variables twice in the Header file? -