Abbas Ogaji Abbas Ogaji - 3 months ago 7
PHP Question

how to replace a special character with another special character using php syntax

Please I want to replace comma I.e

,
if found in the
$_POST['address']
with
space | space
using
str_replace()
or
preg_replace()
. Like:

$ofa = $_POST['address']
$ofa = str_replace or preg_replace

Answer

Here you go:

$ofa = str_replace(',', ' | ', $_POST['address']);

You can read about it here: http://php.net/manual/en/function.str-replace.php