PHP getrandmax() Function

In this chapter you will learn:

  1. Definition for PHP getrandmax() Function
  2. Syntax for PHP getrandmax() Function
  3. Parameter for PHP getrandmax() Function
  4. Return for PHP getrandmax() Function
  5. Example - Return largest possible random value that can be returned by rand()

Definition

The getrandmax() function returns the largest possible value that can be returned by rand().

Syntax

PHP getrandmax() Function has the following syntax.

getrandmax();

Parameter

None

Return

Item Description
Return Value The largest possible value returned by rand()
Return Type Integer

Example

Return largest possible random value that can be returned by rand():


<?php
echo(getrandmax()); 
?>

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. Definition for PHP hexdec() Function
  2. Syntax for PHP hexdec() Function
  3. Parameter for PHP hexdec() Function
  4. Return for PHP hexdec() Function
  5. Example - Convert hexadecimal to decimal