Skip to content
  • Register
  • Login

LT BYTES

Learn Tech Bytes

  • Home
  • AWS
  • PHP
Posted inAll / Php

Generate random unique value in php

Surya by SuryaJanuary 30, 2010December 3, 20230
<?php
function random_code()
{
    $string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz0123456789";
    $randval = '' ;

    for($i = 0;$i <= 10;$i++)
    {
        $num = rand() % 62;
        $tmp = substr($string, $num, 1);
        $randval = $randval.$tmp;
    }
    
    echo $randval.uniqid(true);
}
random_code();
TaggedGenerate-Random-Codephp randomphp uniquephp unique random valueRandom-CodeRandom-UniqeId
Surya Narayana Murthy K
Surya
More by Surya

Post navigation

Previous Article Previous article:
wordpress mu installation in localhost
Next Article Next article:
mysql command line windows

Leave a Reply Cancel reply

You must be logged in to post a comment.

Recent Posts

  • Deploying AWS Lambda with Docker & Serverless Framework
  • Create and Update SNS Subscription Filter Policy using Python Boto3
  • Turn on errors in PHP
  • Php coding standards
  • WordPress plugin to save contact information to database

Recent Comments

No comments to show.

Archives

  • February 2025
  • January 2024
  • December 2023
  • March 2013
  • December 2012
  • April 2012
  • August 2011
  • April 2011
  • February 2011
  • January 2011
  • October 2010
  • July 2010
  • June 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009

Categories

  • All
  • AWS
  • Javascript
  • Joomla
  • Php
  • Python
  • Sql
  • Uncategorized
  • Wordpress
Copyright © 2026 LT BYTES.
Powered by WordPress and BNM.
  • Home
  • AWS
  • PHP