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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu May 16 16:01:34 2024 UTC