stdclass
stdclass

Reputation: 3622

How to get real Hexadecimal number from Hex as String

How do I get the proper Hexadecimal number from a Hexadecimal string?

For example:

<?php
$a = 'C8';
$b = 0xC8;
$c = doWhatHere($a);
$b === $c; // true

Upvotes: 1

Views: 64

Answers (1)

stdclass
stdclass

Reputation: 3622

Thanks to @Ryan.

This does the Trick:

<?php
$a = 'C8';
$b = 0xC8;
$c = intval($a, 16);
$b === $c; // true

Upvotes: 2

Related Questions