Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to replace hyphen with blank space / white space? php

Tags:

php

i don't know much about PHP but these days I'm modifying an existing script. I want to know how can I replace - with white or blank space

For example a variable contains 'Love-you' and I want to replace this hyphen between them with a space like this 'Love you'.

I'll appreciate your feed back.

like image 284
mali Avatar asked Nov 29 '22 18:11

mali


1 Answers

$str = str_replace("-", " ", "Love-you");

now $str is "Love you";

http://php.net/manual/en/function.str-replace.php

like image 79
DrColossos Avatar answered Dec 02 '22 06:12

DrColossos