0

I am a PHP developer and I wouldn't have posted this question here if only this error shows up on ALL machines I tested it with.

I currently get this error:

PHP Parse error:  syntax error, unexpected T_FUNCTION in api.php on line 51

I have here the exact copy of api.php and I tell you that I can't see any error in the code

http://pastebin.com/3xe1qnyR

In fact, the same code runs in my local development machine (PHP 5.3) but it still fails on the production machine (PHP 5.2.17)

Any ideas what am I missing here?

2
  • 1
    Not an answer, but a conceptual mistake is using a development machine and a production machine with different versions of PHP, especially major releases. Commented Mar 19, 2012 at 2:17
  • yeah, I was lazy to check the specifications of the development machine since this was a small job. But I will keep that in mind! Thanks Commented Mar 19, 2012 at 2:28

1 Answer 1

4

You are using anonymous function at line 51, which is only supported by php 5.3+, the exact reason why it works on your dev machine with php5.3 and not on ze production with 5.2

http://php.net/manual/en/functions.anonymous.php

Sign up to request clarification or add additional context in comments.

1 Comment

yeah, i just figured that out few minutes ago. I thought the error was on array_walk, turns out it's on the function keyword! thanks. Will accept in 10mins (SO time restrictions)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.