Convert Dell service tags and express service tags with PHP
By: Daniel
I was given the task at my real job of creating some code to find the service tag from the express service tag of Dell laptops. We only had recorded the express service tag for the 100+ laptops and needed to have the service tag in a project we were working on. I was given some very basic information about the relationship between the two and came up with the following code. With this code you can convert service tags into express service tags and the other way around. It uses a base 36 style formating.
function convertExpress($tag) { $index = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','e'); for($i=10; $i>=0; $i--) { $digits[$i] = '0'; for($k=1; $k<=36; $k++) { $tmp = (pow(36, $i)) * $k; $tmp2 = $tag - $tmp; if($tmp2 < 0) { $tmp = (pow(36, $i)) * ($k-1); $digits[$i] = $index[$k-1]; $tag -= $tmp; break; } if($tmp2 == 0) { $digits[$i] = $index[$k]; $tag -= $tmp; break; } } } $leading = 1; foreach($digits as $digit) { /*if($digit != '0') { $num .= $digit; }*/ if($leading) { if($digit != '0') { $leading = 0; $num .= $digit; } } else { $num .= $digit; } } return $num; }
To use this code you could use:
echo convertExpress('(YOUR EXPRESS SERVICE TAG HERE');
Make sure you only use numbers this field.
To get the express service tag from the service tag use the following function:
function convertTag($tag) { $tag = strtoupper($tag); $index = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'); $count = strlen($tag); $count2 = $count - 1; for($i=0; $i<$count; $i++) { $digits[$count2] = substr($tag, $i, 1); $count2--; } $numb = 0; for($i=0; $i<count($digits); $i++) { if($i==0) { $m = 1; } else { $m = pow(36, $i); } $key = array_keys($index, $digits[$i]); $tmp = ($m * $key[0]); $numb += $tmp; } return $numb; }
To use this code you can use:
echo convertTag('(YOUR SERVICE TAG HERE)');




















(10 votes, average: 3.90 out of 5)
June 5th, 2008 at 7:52 pm
I’ve no idea why you needed to search how to convert those codes from Dell. Prmier users from Dell can get several programs for free (depending your purpuse, some have a database with every service tag so they get a program to read the database and writes in a second field the express code, others have other needs). As IT & ICT experts we know that a is not equal to A! You said that you got the task to create some code etc…. I got the convertion algorith in a few seconds from Dell, writing the C program took me maybe 30 minutes from scratch till final release, I’m curious how much time you needed for your whole project?
July 5th, 2008 at 7:42 pm
I should have thought to call Dell and ask for the conversion but did not. It took me maybe 1 hour to figure things out.
September 26th, 2008 at 12:20 pm
Johan,
Was all of that really necessary?
Daniel,
Thanks for the script. Thankful to have found it for a similar project, as I’ve yet to find the Dell program that I can download to get the S/T of a system, and Dell’s Premier website seems to be less than fully functional more than once a week. Now, I can stop searching!
Cheers,
Ward
December 11th, 2008 at 8:32 pm
@Johan: If your coding is on par with your typing or grammar. I highly doubt you executed it in 30min.
@Daniel
Thank you
March 2nd, 2009 at 1:59 pm
Could you please elaborate on the implimentation? How do I need to upload this to my site so I can use it? Thanks so much!