Advertisement

[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

07/04/2008 at 03:18PM PDT, ID: 23540072
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.9

Adding numbers to duplicate values in array

Asked by adamlund in PHP Scripting Language

Tags: PHP

Hi All,

I have a form that collects data on author surnames and initials.  I need to be able to allow duplicate surnames so that they can be used later in my code.  In order to do this I need to be able to search through an array (see typical array below) and add a number to the end of the duplicated surnames.  For example, if the array contained 3 entries of "Jones" then the resulting entries would be "Jones", "Jones1" and "Jones2" (or could start Jones1 etc).  Only the surnames need to have this effect applied.  Surnames can be distinguished as either being more than 2 characters long or every 6th position in the array (there is one surname and a possible 5 initials).  I need the blank values to be kept in the array.  All surnames that are duplicate need this effect applied.  Please see an example below of what I am trying to achieve.

I am really struggling to see how to implement this solution.

Any help much appreciated.

Adam
View the Solution FREE for 7 Days
1:
2:
3:
4:
5:
6:
7:
//array as it exists:
 
$array = array('Smith', 'J', 'S', '', '', '', 'Smith', 'W', 'P', 'K', '', '', 'Jones', '', '', '', 'R', '', 'Jones', '', '', '', 'R', '', 'Hill', 'J', 'K', '', '', '');
 
// Ideal transformation:
 
$array = array('Smith', 'J', 'S', '', '', '', 'Smith1', 'W', 'P', 'K', '', '', 'Jones', '', '', '', 'R', '', 'Jones1', '', '', '', 'R', '', 'Hill', 'J', 'K', '', '', '');
[+][-]07/04/08 03:26 PM, ID: 21935108

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/08 03:28 PM, ID: 21935115

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/08 03:47 PM, ID: 21935149

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/08 03:51 PM, ID: 21935154

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/08 03:55 PM, ID: 21935162

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/04/08 04:01 PM, ID: 21935181

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/08 04:11 PM, ID: 21935201

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: PHP
Sign Up Now!
Solution Provided By: hielo
Participating Experts: 3
Solution Grade: A
 
 
[+][-]07/04/08 04:14 PM, ID: 21935209

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/04/08 04:20 PM, ID: 21935222

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/04/08 04:26 PM, ID: 21935232

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090617-EE-VQP-62 / EE_QW_2_20070628