Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8826767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:13:15+00:00 2026-06-14T07:13:15+00:00

I’ve got an array where PLACEHOLDER is a placeholder for the variable $value that

  • 0

I’ve got an array where PLACEHOLDER is a placeholder for the variable $value that I get later in the code:

$names = array(
    "<a href='http://skyler.com' title='PLACEHOLDER'>Skyler</a>",
    "<a href='http://jesse.com' title='PLACEHOLDER'>Jesse</a>",
    "<a href='http://walter.com' title='PLACEHOLDER'>Walter</a>",
    "<a href='http://skyler.com' title='PLACEHOLDER'>Skyler</a>",
    "<a href='http://hank.com' title='PLACEHOLDER'>Hank</a>",
    "<a href='http://marie.com' title='PLACEHOLDER'>Marie</a>",
    "<a href='http://walter.com' title='PLACEHOLDER'>Walter</a>",
    "<a href='http://walter.com' title='PLACEHOLDER'>Walter</a>",
    "<a href='http://jesse.com' title='PLACEHOLDER'>Jesse</a>",
    );

To check how often an equal value is in my array,
I count them with array_count_values.

$count = array_count_values($names);

foreach ($count as $key => $value) {
    echo $value . ' – ' . $key . '<br />';
}

So I get something like this:

3 – <a href='http:/walter.com' title='PLACEHOLDER'>Walter</a>
2 – <a href='http://jesse.com' title='PLACEHOLDER'>Jesse</a>
2 – <a href='http://skyler.com' title='PLACEHOLDER'>Skyler</a>
1 – <a href='http://hank.com' title='PLACEHOLDER'>Hank</a>  
1 – <a href='http://marie.com' title='PLACEHOLDER'>Marie</a>

Now I’d PLACEHOLDER be replaced by $value, so I get the number as title tag of the link.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:13:16+00:00Added an answer on June 14, 2026 at 7:13 am
    foreach ($count as $key => $value) {
        echo $value . ' – ' . str_replace('PLACEHOLDER', $value, $key) . '<br />';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got an array which I iterate over and try to create a variable.
I got an array like that Array ( [0] => Array ( [UnitESN] =>
I've got an array called $bigArrayWithLinks that stores a string with a url in
I've got an array of names: $names = array('ray'=>0,'bob'=>1,'sue'=>2,'jeff'=>3); Then I have a table
I've got an array of channels that I want to transform into a single
I've got an array of values that i need to parse through and extract
I've got an array of strings that looks like this: [noindex,nofollow] or [index, follow,
how to get the value 4500 to a variable stdClass Object ( [total] =>
I have a variable that is an array in Smarty, and I am trying
I've got an array of objects that I'm wanting to sort through according to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.