1
array_walk ($this->something, [$this, 'function_name'], $part_something);

Parse error: syntax error, unexpected '[' in /.../...php on line 67

This works on my local test environment, but not on the server.

0

2 Answers 2

3

Are you running PHP 5.4 in production? If not the bracket syntax is not a valid way to represent an array in PHP 5.3 and below as it is a new feature in 5.4.

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

Comments

1

Try with:

array_walk ($this->something, array($this, 'function_name'), $part_something);

Look at this https://www.php.net/manual/en/function.array-walk.php

2 Comments

class method name: array_walk($this->something, array($this, 'function_name'), $part_something);
Yes, correct... I realized only now that you are calling a method of the same class.

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.