PHP Classes

PHP Generate Unique ID from String: Generate unique identifier strings

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 245 All time: 7,989 This week: 673Up
Version License PHP version Categories
generate-id 1.0.0GNU General Publi...5PHP 5, Text processing
Description 

Author

This class can generate unique identifier strings.

It can take as parameters string prefix, an id number and a given string length.

The class combines the prefix and the ID number and generates a string with the given length if necessary padding the id number with zeros.

Picture of Rongala Prasad
  Performance   Level  
Name: Rongala Prasad <contact>
Classes: 1 package by
Country: India India

Example

<?php

require_once "GenerateID.php";

$genid = new GenerateID();
$genid->setPrefix("CUST");
$genid->setMaxLength(4);
$genid->setId(123);
echo
$genid->generate();


  Files folder image Files (2)  
File Role Description
Plain text file example.php Example Example file
Plain text file GenerateID.php Class GenerateID class file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:245
This week:0
All time:7,989
This week:673Up
 User Ratings  
 
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:-
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:64%StarStarStarStar
Rank:748