Jump to content

how to split dash in php?


lilywong

Recommended Posts

[!--quoteo(post=357525:date=Mar 23 2006, 09:13 AM:name=rach)--][div class=\'quotetop\']QUOTE(rach @ Mar 23 2006, 09:13 AM) [snapback]357525[/snapback][/div][div class=\'quotemain\'][!--quotec--]
i have a list of phone number key in with 012-34567897
i want to split the '-' so that the phone number become 01234567897.

anyone knows how to do that ? thanks
[/quote]

i guess this would do you:

[code]
$num = str_replace('-', '', $num);
[/code]

hope that helps
[!--quoteo(post=357528:date=Mar 23 2006, 09:23 AM:name=rach)--][div class=\'quotetop\']QUOTE(rach @ Mar 23 2006, 09:23 AM) [snapback]357528[/snapback][/div][div class=\'quotemain\'][!--quotec--]
anyway we can do that using sql command ?
[/quote]

you'd have to check, but something like:

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] REPLACE(Telnum, [color=red]'[span style=\'color:orange\']-[/color]'[/span], '') [color=green]as[/color] NiceTelnum [color=green]FROM[/color] [color=orange]mytable[/color] [!--sql2--][/div][!--sql3--]

may work for you

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.