Reputation: 23
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.
Upvotes: 0
Views: 154
Reputation: 2147
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));
Upvotes: 1
Reputation: 21531
This is a url encoded string so you need to use the urldecode()
function on this, not html_entity_decode
.
Upvotes: 1