0

I am trying to decode a paragraph using the PHP code below:

$str="Campaign+Description%0D%0A%0D%0AOperators+AIS+%0D%0A%0D%0ANot+allowed%3A%0D%0AIncent%0D%0AContent+Lock%0D%0ASMS+%26+Email%0D%0AVirtual+currency%0D%0AWiFi";
html_entity_decode(htmlentities($str));

However, I am not able to decode it and get the correct output.

Leigh
  • 28,765
  • 10
  • 55
  • 103

2 Answers2

1

This is a url encoded string so you need to use the urldecode() function on this, not html_entity_decode.

fire
  • 21,383
  • 17
  • 79
  • 114
1

The string which you are tying to decode is url, not textual paragraph. So use urldecode() function.

Try below code :

$str="Campaign+Description%0D%0A%0D%0AOperators+AIS+%0D%0A%0D%0ANot+allowed%3A%0D%0AIncent%0D%0AContent+Lock%0D%0ASMS+%26+Email%0D%0AVirtual+currency%0D%0AWiFi";
urldecode(htmlentities($str));
Manthan Dave
  • 2,137
  • 2
  • 17
  • 31