how to decode strings using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
seco
Forum Newbie
Posts: 23
Joined: Tue Jan 08, 2008 10:40 pm

how to decode strings using php

Post by seco »

Hi
i use this js function to decode my strings like (%u0645%u062D%u0645%u062F) and works very well and returns correct results with me
unescape(encoded.replace(/\+/g, " "));

i want php function that can do the same.
i try urldecode and rawurldecode but they do nothing !! just return the strings as it is .

thanks in advance.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: how to decode strings using php

Post by Jonah Bron »

You can't. The only way to verify data, is to check if the data in encrypted form matches the already-encrypted data.
PHP: crypt - Manual wrote:Notes
Note: There is no decrypt function, since crypt() uses a one-way algorithm.
http://us2.php.net/manual/en/function.crypt.php
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Re: how to decode strings using php

Post by liljester »

i think hes talking about url encoding/decoding, not encryption
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Re: how to decode strings using php

Post by liljester »

have you tried the user contributed suggestions on the urldecode documentation site?
Post Reply