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

  • SEARCH
  • Home
  • 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 7065499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:57:49+00:00 2026-05-28T04:57:49+00:00

need value advice and help me to sort out the following issue. function max_key($array)

  • 0

need value advice and help me to sort out the following issue.

function max_key($array) {
foreach ($array as $key => $val) {
    if ($val == max($array)) return $key;
    }
}

$SortingVote = array();

for ($i=0; $i<10; $i++) {

   $SortingVote[] = $i;
}

$array = $SortingVote;

$array_count=count($array);    
for($i=0;$i<=$array_count;$i++){
    $max_val[$i]=max_key($array);

    $voteValue_View=$array[$max_val[$i]];

    unset($array[$max_val[$i]]);


    $VoteValue_New[$i] = $voteValue_View;
    echo "Vote Value manual = $VoteValue_New[$i] <br />"; 
}

It works fine and display the value when I am running it on my local machine via MAMP Mac version (PhP & MySQL). But, it display nothing when I deployed on my production server. And it is weird? Just received the following:

Vote Value manual = 

Appreciate if anyone can guide me on this. Cheers

  • 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-05-28T04:57:50+00:00Added an answer on May 28, 2026 at 4:57 am

    I’m just rewriting this, seems easier:

    arsort($array);
    foreach(array_slice($array,0,10,true) as $key => $value){
         echo "Vote Value manual = $value <br />"; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The xmlns attribute in the following code stops me getting the value I need.
When creating a new entity object that has a foreign key value I need
I'm designing a Java based web-app and I need a key-value store. Berkeley DB
For example i have this xml. I need to get value of parameter val
Help, I am a noob, just need some advice on this bit of code.
Need someone to help me to crack the following. On my local machine, i'm
i need Enumarable value from below class but give error public static Enumerable LoadDataByName(string
MSDN docs say that only value types need boxing, but this does not apply
I have an app where I need a BOOL value to persist across launches.
I'm creating a set of enum values, but I need each enum value 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.