Sangha-08 Posted October 19, 2008 Share Posted October 19, 2008 When i go to http://www.mywebsite.com/test.php?v=This-is-an-example I want it to replace the "-" with space, I tried using the following code, but it doesn't work <?PHP $thethingweget = $_GET['v']; print (preg_replace('-', ' ', $thethingweget)); ?> Link to comment https://forums.phpfreaks.com/topic/129103-solved-preg_replace-help/ Share on other sites More sharing options...
raimis100 Posted October 19, 2008 Share Posted October 19, 2008 you can just use str_replace $data, = str_replace ("-", "", $data) Link to comment https://forums.phpfreaks.com/topic/129103-solved-preg_replace-help/#findComment-669271 Share on other sites More sharing options...
Sangha-08 Posted October 19, 2008 Author Share Posted October 19, 2008 Ok, i tried using this, it still doesnt work ;( <?PHP $data = $_GET['v']; $data = str_replace ("-", "", $data); ?> when i go to my website http://www.mywebsite.com/test.php?v=a-a-a it just gives me a blank page ;( Link to comment https://forums.phpfreaks.com/topic/129103-solved-preg_replace-help/#findComment-669274 Share on other sites More sharing options...
Sangha-08 Posted October 19, 2008 Author Share Posted October 19, 2008 any1? Link to comment https://forums.phpfreaks.com/topic/129103-solved-preg_replace-help/#findComment-669282 Share on other sites More sharing options...
trq Posted October 19, 2008 Share Posted October 19, 2008 <?php $data = $_GET['v']; $data = str_replace ("-", " ", $data); ?> Link to comment https://forums.phpfreaks.com/topic/129103-solved-preg_replace-help/#findComment-669283 Share on other sites More sharing options...
Sangha-08 Posted October 19, 2008 Author Share Posted October 19, 2008 <?php $data = $_GET['v']; $data = str_replace ("-", " ", $data); ?> That doesn't work ;( Link to comment https://forums.phpfreaks.com/topic/129103-solved-preg_replace-help/#findComment-669286 Share on other sites More sharing options...
trq Posted October 19, 2008 Share Posted October 19, 2008 It does exactly what you describe. How are you using this $data variable? Be more specific than doesn't work. Link to comment https://forums.phpfreaks.com/topic/129103-solved-preg_replace-help/#findComment-669293 Share on other sites More sharing options...
Sangha-08 Posted October 19, 2008 Author Share Posted October 19, 2008 It does exactly what you describe. How are you using this $data variable? Be more specific than doesn't work. Oh, sorry, sorry, my fault I figured it out now. thanks for you help LOVE YOU GUYS!!! Link to comment https://forums.phpfreaks.com/topic/129103-solved-preg_replace-help/#findComment-669295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.