Tuesday, 15 July 2014

php - Replace ampersand(&) into %26 in the query string -



php - Replace ampersand(&) into %26 in the query string -

i getting query string q=pen&fq[category]=pens & refills&fq[category_id]=34, how replace & %26 in pens & refills, not &. please help me using regular look pattern.

if reason need replace character, can without using regex.

$string = str_replace(' & ', ' %26 ', $string);

php regex url

No comments:

Post a Comment