php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #26433 Request for is_unique()
Submitted: 2003-11-27 04:45 UTC Modified: 2016-06-14 12:32 UTC
Votes:4
Avg. Score:4.0 ± 1.0
Reproduced:0 of 1 (0.0%)
From: samtheman at tioga dot net Assigned: cmb (profile)
Status: Wont fix Package: Strings related
PHP Version: * OS: *
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 — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
11 + 49 = ?
Subscribe to this entry?

 
 [2003-11-27 04:45 UTC] 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";
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-30 03:31 UTC] 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;
  }
 [2010-11-18 23:24 UTC] jani@php.net
-Package: Feature/Change Request +Package: Strings related -Operating System: All +Operating System: * -PHP Version: Irrelevant +PHP Version: *
 [2014-03-05 20:55 UTC] narf at devilix dot net
Indeed ... a userland solution is easy enough to write.
-1
 [2016-06-14 12:32 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2016-06-14 12:32 UTC] cmb@php.net
Considering the age of this request and the rather few votes in
favor, there obviously is not a widespread need for this
functionality, which can easily be implemented in userland anyway.
So I'm closing as won't fix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 07:01:31 2024 UTC