Jump to content

PNR Number


vikrantmohite

Recommended Posts

Hi,

 

I want to generate a 10 digit PNR number in one of my application.  :)

 

The PNR number to be generated should use the following :

 

1. The name of the passenger(s).

2. Contact details for the travel agent or airline office. (The minimum contact information enforced by CRS policy is typically the 8-digit IATA code of the travel agency or airline office, although there is usually at least one phone number as well, most often the agency phone number. Direct customer contact information is rarely required.)

3. Ticketing details, either a ticket number or a ticketing time limit.

4. Itinerary of at least one segment, which must be the same for all passengers listed.

5. Name of the person providing the information. (This is usually entered in a "received from" field and recorded in the "history" or change log attached to the PNR, along with the user and office or agency ID of the airline or travel agency employee creating the PNR or entering the change. The "history" records the "received from" data separately for the initial creation of the PNR and for each subsequent change to it.)

 

For better understanding of PNR follow http://en.wikipedia.org/wiki/Passenger_name_record

 

I was planning to do MD5() on all the above fields but that will give me more than 10 letters(alphanumeric)

 

Though it is mention in wiki that PNR can be Alphanumeric, I want to generate a Numeric PNR.  ;)

 

Please help me on this.

 

Regards,

Vikrant

Link to comment
Share on other sites

Well, you could just crop the MD5 hash to the desired length. Example:

 

$forty_bits = substr($md5_hash, 0, 10); // 40 bits (10 hex digits of 4 bits each) is enough for a 10 digit decimal number
$decimal = base_convert($forty_bits, 16, 10); // Convert from hexadecimal (base 16) to decimal
$ten_digits = substr($decimal, 0, 10); 
$padded_result = str_pad($ten_digits, 10, '0', STR_PAD_LEFT); // Pad the resulting number to 10 digits, just in case

Link to comment
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.