Jump to content

PARSING DL CODES


Go to solution Solved by 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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.