I have a problem how do i replace a single dash(-) with a single space.
I tried the following
$test = TEST-test;
preg_replace('\-', '/s', $test);
echo $test;
but no result.
thx,
Behold the strtr
:
$test = strtr($test, '-', ' ');
Btw, your original code has TEST-test
, that needs to be wrapped in quotes:
$test = 'TEST-test';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With