🔒 Closed Pahelp naman po about sa PHP

Status
Not open for further replies.
Try niyo po magtanong sa stackoverflow....maraming sasagot doon na expert...linawin mo lang yung tanong mo....dapat din po english
 
get mo yung current time then gamit ka md5 function
Tama siya, para walang identical. Medyo challenging to if ever naka database kasi you need to check whether the generated serial number is already existing but varies on the format you like.
ex:
Code:
<?php
//gerate auto SSN based on current date and record number
//ex: 20210301/0002
 $datesn=date("Ymd");

 $rec_no=1; //record count, increment 1 if exxisting from the list
 //str_pad for padded string or with leading zeros with size of n
 //visit: https://www.php.net/manual/en/function.str-pad.php
    echo $datesn.'/'.str_pad($rec_no,4,0,STR_PAD_LEFT);
?>
 
uniqid() - The uniqid() function generates a unique ID based on the microtime (the current time in microseconds).

PHP:
<?php
echo uniqid();
?>

Ref: You do not have permission to view the full content of this post. Log in or register now.

use MD5 or SHA1: md5(), sha1()
PHP:
<?php
echo(md5('string here'));
echo(sha1('string here'));
?>

Ref: You do not have permission to view the full content of this post. Log in or register now. , You do not have permission to view the full content of this post. Log in or register now.

use substr and str_shuffle

PHP:
<?php
$permitted_chars = '0123456789abcdefghijklmnopqrstuvwxyz';
echo substr(str_shuffle($permitted_chars), 0, 10);
?>

Ref: You do not have permission to view the full content of this post. Log in or register now.
at madami pang iba.
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 6
    Replies
  • 599
    Views
  • 6
    Participants
Last reply from:
SakuraX

Online now

Members online
451
Guests online
1,277
Total visitors
1,728

Forum statistics

Threads
2,277,853
Posts
28,979,294
Members
1,229,112
Latest member
rosearugay
Back
Top