Jump to content

[SOLVED] string replace with hyphen


vinpkl

Recommended Posts

hi all

 

i am generating a url dynamically in which

 

<?php

$cname= "Mobile Phones"

?>

 

in the url i get

Mobile%20Phones

 

How can i replace %20 in it with - hyphen sign

 

i have tried

<?php
$cname= "Mobile%20Phones"
echo str_replace($cname,"%20","-");
?>

 

not able to get it work.

 

how can i make it echo "Mobile-Phones"

 

vineet

Link to comment
https://forums.phpfreaks.com/topic/137794-solved-string-replace-with-hyphen/
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.