Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,326 members, 7,811,963 topics. Date: Monday, 29 April 2024 at 02:10 AM

How To Generate Unique 10/11 Digits Nuban / BVN With PHP - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How To Generate Unique 10/11 Digits Nuban / BVN With PHP (9344 Views)

10 Nights Of Cloning Nairaland With PHP / How Can I Generate Unique Random Num Wt Php Oop / Payment System Integration Webpay(interswitch) With Php (2) (3) (4)

(1) (Reply)

How To Generate Unique 10/11 Digits Nuban / BVN With PHP by Nobody: 8:10am On Jun 23, 2015
Here is to PHP lovers, now let us assume you are building a bank portal and you have created your numbers database and you now wish to generate unique 10 digits NUBAN or 11 digits BVN for your customers, here is a simple way to convert a simple digit like 1 into a unique collision-free 10 digit sequence:

<?php
$id=1; //this is the autoincremented id of the customer

//10 digits nuban number
$nuban = strrev(substr((int)($id/5 * 10).rand(pow(10,10), pow(10,11) - 1),0,10));

//11 digits bvn number
$bvn = strrev(substr((int)($id/5 * 10).rand(pow(10,10), pow(10,11) - 1),0,11));

//results
echo 'Your NUBAN is $nuban, and your bvn is '.$bvn;
?>
Disclaimer: please note that this is just a trollin' sample, and no actual BVNs/NUBANS were generated at anytime by disclaimer. And no bank customer was defrauded at any time by this code.

2 Likes

Re: How To Generate Unique 10/11 Digits Nuban / BVN With PHP by Nobody: 10:42am On Jun 24, 2015
cool cool

(1) (Reply)

I Have A Problem With Raise Event In C# / Laravel:call To Undefined Method Illuminate\database\eloquent\collection::save() / My First Month At The ALX Software Engineering Programme

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 9
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.