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 8685001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:26:59+00:00 2026-06-12T22:26:59+00:00

This is my code that is working nice on my localhost: <?php $list =

  • 0

This is my code that is working nice on my localhost:

<?php
$list = array();
array_map(function($var){}, $matches_array_1);
foreach ( $matches_array_1 as $value ) {
    $key = $value['team'];

    if (array_key_exists($key, $list)) {
        $list[$key]['team_points'] += $value['team_points'];
        $list[$key]['team_occurrences'] ++;
    } else {
        $list[$key] = $value;
        $list[$key]['team_occurrences'] = 1;
    }
}
usort($list ,function($a, $b){ $a = $a['team_points'] ; $b = $b['team_points'] ; return ($a == $b) ? 0 : (($a < $b) ? 1 : -1 ) ;});

?>

But on the server it throws an error:

Parse error: syntax error, unexpected T_FUNCTION, expecting ‘)’

for this line:

array_map(function($var){}, $matches_array_1);

My localhost WAMP PHP version is 5.4.3

My server PHP version is 5.2.17

I would like to change th code so it works on both environments.

Thanks for any advice.

  • 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-12T22:27:00+00:00Added an answer on June 12, 2026 at 10:27 pm

    Anonymous functions are available from PHP 5.3.0. See http://php.net/manual/en/functions.anonymous.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have been working on this code that creates a table with radio
I had this working in an old code that I didn’t end up using...
I've recently been working with code that looks like this: using namespace std; class
In this code that uses the mongodb-native driver I'd like to increase the value
I'working on this nice example that shows a webcam output in a GTK widget
I've been working on this simple code that puts a CSV file into a
I have this code that I've edited: http://pastebin.com/vrqHek6S I've put in comments where I
I have this code that runs but never stops. class A { public static
I have this code that reads from XML file. It gets five strings (groupId,
I have this code that suppose to place the marker by the latlng public

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.