Jump to content

PARSING DL CODES


Coastal_Life

Recommended Posts

I am trying to parse information from a FL drivers license Magnetic Strip.  The information below should explain better.

 

These are the numbers in the stip:  ;6360101262000786187=2105197499270=?

 

I have made bold (above) the numbers needed from the string.

 

Actual numbers:

  • 86
  • 05
  • 27

Placement in the string counting from left to right (including all charactors):

  • 16 & 17
  • 24 & 25
  • 32 & 33
function get_age($birth_date){
 return floor((time() - strtotime($birth_date))/31556926);
 }

echo get_age("1986-05-27");

Any thoughts?

 

Thank you for your help.

Link to comment
https://forums.phpfreaks.com/topic/285450-parsing-dl-codes/
Share on other sites

If you know the positions then use substr

$DL = ';6360101262000786187=2105197499270=?';

$numbers  = array();
// number positions
$postions = array(15, 23, 31);
// loop over the positons
foreach($postions as $postion)
{
    // get the number
    $numbers[] = substr($DL, $postion, 2);
}

printf('<pre>%s</pre>', print_r($numbers, true));
Link to comment
https://forums.phpfreaks.com/topic/285450-parsing-dl-codes/#findComment-1465585
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.