hi,
$line="something & nothing find it"
A string i want a regular expression to convert & to & but not of one
Anyone for help for this
Regards
| SitePoint Sponsor |



hi,
$line="something & nothing find it"
A string i want a regular expression to convert & to & but not of one
Anyone for help for this
Regards


PHP Code:$str = preg_replace("/& /", "& ", $str);
17-29% of paid ad clicks are fraudulent. Get protected with Improvely, your online marketing dashboard.
→ Conversion tracking, click fraud detection, A/B testing and more.
str_replace() would be a better way, in this case.
OrOrPHP Code:$result = preg_replace('/&\B/', '&', $subject);
PHP Code:$line = 'something & nothing find it';
$line = htmlentities($line, ENT_NOQUOTES, 'UTF-8', false);
#something & nothing find it
Bookmarks