Re: Convert hex string to hex value?
| From: | Adam Richardson | Date: | Fri, 22 Oct 2010 06:31:55 +0000 |
| Subject: | Re: Convert hex string to hex value? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308988@lists.php.net to get a copy of this message | ||
On Fri, Oct 22, 2010 at 1:05 AM, Micky Hulse <mickyhulse.lists@gmail.com>wrote:
> Hi,
>
> I must be tired because I can't figure this out... I am sure it is
> something obvious.
>
> I need to pass a hex value to a method, but I can't figure out how to
> convert a hex string to a hex value.
>
> For exmaple:
>
> $base = '96989b'
> my_method('0x' . $base)
>
> The above does not work with my_method().
>
> my_method(0x96989b)
>
> The above works without any problems.
>
> Any tips?
>
> Many thanks in advance!
>
> Micky
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Hi Micky,
I suspect the issue is the conversion from string to a number in your
example:
http://www.php.net/manual/kr/language.types.string.php#language.types.string.conversion
In your second example, you're directly inputing a hex number, so there's no
issue.
Hope you get some rest :)
Adam
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com