php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32569 array_rand problem with length of array
Submitted: 2005-04-04 16:06 UTC Modified: 2005-04-04 16:25 UTC
From: mail at sebastianburg dot de Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.3.10 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mail at sebastianburg dot de
New email:
PHP Version: OS:

 

 [2005-04-04 16:06 UTC] mail at sebastianburg dot de
Description:
------------
array_rand($array,$num);

if $num > count($array) the return of array_rand is NULL



Reproduce code:
---------------
http://code.smb-media.de/?nr=5
http://code.smb-media.de/show/array_rand.php


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-04 16:25 UTC] betz@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Try increasing your error_reporting level.
Make sure, to not pick more random values as your array holds elements.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Sep 10 22:01:27 2024 UTC