Edit report at https://bugs.php.net/bug.php?id=64056&edit=1

 ID:                 64056
 Updated by:         paj...@php.net
 Reported by:        joern dot berkefeld at bittubes dot com
 Summary:            array_rand returns differ - should always be an
                     array
-Status:             Open
+Status:             Wont fix
 Type:               Feature/Change Request
 Package:            *General Issues
 Operating System:   -
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

We can't change that due to backward compatibility reason.


Previous Comments:
------------------------------------------------------------------------
[2013-01-23 14:57:37] joern dot berkefeld at bittubes dot com

Description:
------------
---
>From manual page: http://www.php.net/function.array-rand
---

>From the manual:
"If you are picking only one entry, array_rand() returns the key for a random 
entry. Otherwise, it returns an array of keys for the random entries"

That causes problems as this functionality is unexpected. Functions should 
always 
return the same type (or false / null for failure)

Expected result:
----------------
get an array regardless of the number of results

Actual result:
--------------
the function returns an integer for one result and an array for multiple results


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64056&edit=1

Reply via email to