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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:21:54+00:00 2026-06-05T16:21:54+00:00

Ok, so lets start with the code <?php function LuhnCalc($number) { $chars = array_reverse(str_split($number,

  • 0

Ok, so lets start with the code

<?php
function LuhnCalc($number) {
  $chars = array_reverse(str_split($number, 1));
  $odd = array_intersect_key($chars, array_fill_keys(range(1, count($chars), 2), null));
  $even = array_intersect_key($chars, array_fill_keys(range(0, count($chars), 2), null));
  $even = array_map(function($n) { return ($n >= 5)?2 * $n – 9:2 * $n; }, $even);
  $total = array_sum($odd) + array_sum($even);
  return ((floor($total / 10) + 1) * 10 – $total) % 10;
}

print LuhnCalc($_GET['num']);
?>

The errors are showing in the following lines

  $even = array_map(function($n) { return ($n >= 5)?2 * $n – 9:2 * $n; }, $even);


  return ((floor($total / 10) + 1) * 10 – $total) % 10;

The errors are

Parse error: syntax error, unexpected T_FUNCTION, expecting ‘)’ in
/home/MONKEY DO /public_html/gateway/crn.php on line 6

  • 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-05T16:21:55+00:00Added an answer on June 5, 2026 at 4:21 pm

    The error message says “I got a function but I expected a )“. It’s telling you that according to the grammar of the parser, the token function isn’t expected to happen at that point. When you write array_map(function(... you are passing an anonymous function by using the token function, which the compiler doesn’t like.

    Anonymous functions were introduced in PHP 5.3. You’re probably running and older version of PHP. Check what version you’re running, and upgrade if you need to.

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

Sidebar

Related Questions

stuck on this. Lets start with code. Settings.php class settings{ public $db_host; public $db_username;
Ok, lets start with the code. I am looping through a returned array of
So lets say i have a block of php code and i have an
I have written a simplte PHP login script which starts a session: //Lets start
Lets start by saying that I am debugging someone else's code :-) The error
Lets start off with a list of strings that will be used to filter
Lets go from the start Created New Xcode project,opened interface builder dragged one NSButton
Lets say I have the following script k <- as.numeric(readline(Start Index: )) tot <-
I have the following pages: page1.php, page2.php and page3.php. Code in each of them
i have code like this. which is actually a form .which lets user updates

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.