Req #26433 [Com]: Request for is_unique()
Edit report at https://bugs.php.net/bug.php?id=26433&edit=1
ID: 26433
Comment by: narf at devilix dot net
Reported by: samtheman at tioga dot net
Summary: Request for is_unique()
Status: Open
Type: Feature/Change Request
Package: Strings related
Operating System: *
PHP Version: *
Block user comment: N
Private report: N
New Comment:
Indeed ... a userland solution is easy enough to write.
-1
Previous Comments:
------------------------------------------------------------------------
[2003-11-30 03:31:56] samtheman2 at tioga dot net
function is_unique() {
$numargs = func_num_args();
$args = func_get_args();
if(count(array_unique($args)) == $numargs) {
return TRUE;
}else{
return FALSE;
}
------------------------------------------------------------------------
[2003-11-27 04:45:03] samtheman at tioga dot net
Description:
------------
Would like to see a function for comparing strings. is_unique() seems to be open.
Ability to compare more than 2 strings for uniqueness, if they are not unique false is returned,
else true.
$choice1 = "yes";
$choice2 = "no";
$choice3 = "maybe";
$choice4 = "no";
if(is_unique($choice1,$choice2,$choice3,$choice4)){
echo "yes";
}else{
echo "no";
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=26433&edit=1
Thread (4 messages)