I want to add backslash before every character in php
below is my string
AT POST :- SARIGAM, (BHANDARI STREET)
PIN : 396155 STATE: GUJARAT
VALSAD GUJARAT 396155
India
Some special character are not i this string but answer should be valid for all the special character.
I have tried below, but not able to success.
if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', $address))
{
str_replace('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/', "\\", $address);
}