NYCPHP Meetup

NYPHP.org

[nycphp-talk] Converting hex?

Rob Marscher rmarscher at beaffinitive.com
Tue Sep 5 11:43:27 EDT 2006


Did you figure this one out?

Try

$data - file_get_contents($some_remote_https_url);
$pieces = explode(',', data);
print preg_replace("/(\\\x[0-9A-Fa-f]{1,2})/e", "chr(hexdec('\\1'))", $pieces[0]);

Seems to do the trick.
-Rob

Jeff Loiselle wrote:
> Anyone know of a nice efficient function to convert this?
> $name = 'Tony D\x27Antonio';
>
> I realize that putting it in double quote will do it, but I am unable
> to do that. As I am doing something like this:
>
> $data - file_get_contents($some_remote_https_url);
> $pieces = explode(',', data);
> print $pieces[0];
>
> Output:
> Tony D\x27Antonio
>
> This doesn't seem to help:
> print "$pieces[0]";
>
> I'm looking for the most efficient way, as this is being used in a
> REST response parser. Thanks!
>
> ---
> Jeff Loiselle
> Web Developer
> The NewNewMedia Group
> http://www.newnewmedia.com
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
>   




More information about the talk mailing list