Jump to content

[SOLVED] evaluating an escaped string


RussellReal

Recommended Posts

lets say I have this string '\n\t\r\n\n\x3C' is there a function which CAN properly handle each special escape char's special meaning..

 

I don't know how to explain it, I just hope someone can understand what I am trying to say..

 

I tried strip slashes

but that just turns:\n\t\r\n\n\x3C

into: ntrnnx3C

 

and I want it to turn it into the special meanings

Link to comment
Share on other sites

okay.. lets give an example

 

I have a text file called

 

blah.txt

 

which contains

 

\x3cb\x3eOMG NO FREAKING WAY\x3c/b\x3e

 

now when I do

$e = file_get_contents("blah.txt");

 

$e will contain the contents, EXACTLY as it was in the text file.. I want the hex to evaluate, I want to know if there is a function to do so.

 

Thank you very much foir your replies so far guys

Link to comment
Share on other sites

lol... I KNOW what  the difference in QUOTES are.. nevermind forget I asked.. lol

 

Sorry about that, it is hard to know how much you know, especially since you are relatively new.

 

Do you know how the text is being entered into the text file? Like is html_entities is being used or if it is being entered using utf8_encode ?

 

Not sure of either of those would help you out or not....

Link to comment
Share on other sites

Yeah, I really don't think theres a file, I'd have to pull something like eval("\$var = \"{$actualVar}\";");

 

to evaluate the \n \r you know the escaped characters, I just set up a str replace

 

$image[] = str_replace(array('\x3c','\x3e','\x3d','\x26'),array('<','>','=','&'),substr($data,$q1 + 1,$start - ($q1 + 1)));

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.