Jump to content

Stripping charachters from a variable


tcorbeil

Recommended Posts

Hello again.

 

Someone gave me this script to replace special characters from a variable with "_"..

 

$Subpage = ereg_replace("[^[:alpha:]]", "_", $Subpage);

 

 

problem is that it also replaces numbers.. so if i have "$Subpage="Nintendo 64";

after $Subpage = ereg_replace("[^[:alpha:]]", "_", $Subpage); i would get a value of Nintendo___.. I would like to achieve a value of Nintendo_64..

 

Any advise would be much appreciated..

T.

Link to comment
https://forums.phpfreaks.com/topic/44653-stripping-charachters-from-a-variable/
Share on other sites

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.