|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45531 description on rand() is wrong
Submitted: 2008-07-16 16:56 UTC Modified: 2008-07-21 09:13 UTC
From: wayne at emaildienst dot de Assigned:
Status: Closed Package: Translation problem
PHP Version: Irrelevant OS: none
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
32 - 18 = ?
Subscribe to this entry?

 [2008-07-16 16:56 UTC] wayne at emaildienst dot de
hi, following description is wrong:

int rand  ([ int $min  ], int $max  )

it should be:

int rand ([[int $min], int $max])

because all parameters are optional.

if there is only one given parameter, the function gets it as $max.
if there are two parameters given, the function gets the first as $min and the second as $max.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-16 17:41 UTC]
It looks correct to me in the english version of the manual; where are you seeing it like that? 

I can see it in the German translation, so I'll change the category to translation problem.
 [2008-07-16 19:43 UTC] wayne at emaildienst dot de

yes in the german documentation is the error.

and yes the english version is correct.

int rand  ( int $min  , int $max  )
is the correct description.
 [2008-07-21 09:13 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Mar 28 08:03:41 2023 UTC