PHP srand

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : srand() function

Description

The srand() function seed the random number generator.

Version

(PHP 4 and above)

Syntax

srand(num)

Parameter

Name

Description

Required /
Optional

Type

num

Seed value. If omitted, a random value is used.

Optional

Integer

Return value

No value is returned.

Example :

  1. srand(mktime());  

  2. echo rand();  

  3. ?>