# PHP getrandmax() Function

PHPServer Side ProgrammingProgramming

## Definition and Usage

The getrandmax() function returns largest integer that can be used in PHP. Value returned by this function serves as the upper limit for rand() function to generate random number.

This function always returns an integer.

## Syntax

getrandmax ( void ) : int

## Parameters

Sr.NoParameter & Description
1This function needs no parameters

## Return Values

PHP getrandmax() function returns largest possible integer that can be used in PHP. On 64 bit Windows, the number is 2147483647

## PHP Version

This function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.

## Example

Live Demo

Following example returns largest possible integer−

<?php
echo "Largest Integer = " . getrandmax() . "\n";
?>

## Output

This may produce following result (it being a random number, it is more likely to return different number every time)−

Largest Integer = 2147483647
Published on 29-Jun-2020 12:24:47