- substr: documentation ( source)
- str_replace: documentation ( source)
<?php
$data = '0x8000000';
$data = substr($data, 2); //remove the 0x prefix from the string
$data = str_replace(' ', '', $data); //remove the spaces from the string
//$data is now '11210031'
echo 'the product number is ' . $data[0] . "\n";
if ($data[1] == 1) {
echo "this is a new product\n";
} else if ($data[1] == 2) {
echo "this is a used product\n";
}