lilywong Posted March 23, 2006 Share Posted March 23, 2006 i have a list of phone number key in with 012-34567897i want to split the '-' so that the phone number become 01234567897.anyone knows how to do that ? thanks Link to comment https://forums.phpfreaks.com/topic/5572-how-to-split-dash-in-php/ Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 [!--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-34567897i 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 Link to comment https://forums.phpfreaks.com/topic/5572-how-to-split-dash-in-php/#findComment-19880 Share on other sites More sharing options...
lilywong Posted March 23, 2006 Author Share Posted March 23, 2006 anyway we can do that using sql command ? Link to comment https://forums.phpfreaks.com/topic/5572-how-to-split-dash-in-php/#findComment-19881 Share on other sites More sharing options...
redbullmarky Posted March 23, 2006 Share Posted March 23, 2006 [!--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 Link to comment https://forums.phpfreaks.com/topic/5572-how-to-split-dash-in-php/#findComment-19883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.