PHP Error: Function Name Must Be a String

PHP Error: Function name must be a string

It should be $_COOKIE['name'], not $_COOKIE('name')

$_COOKIE is an array, not a function.

Fatal error: Function name must be a string in.. PHP error

$mysql_query($query); => mysql_query($query);. Note the missing dollar. If you try to use function call syntax on a variable, it looks for a function with the name given by the value of the variable. In this case, you don't have a mysql_query variable, so it comes back with nothing, which isn't a string, and thus gives you the error.

Fatal error: Uncaught Error: Function name must be a string

I have found that…

$validation_result = {$login->$value['validate']}($value['value']);

works for me.
another similar question

I get this error Function name must be a string

You can use call_user_func. ref: this

call_user_func(self::$logferr, $res);

Error: Function name must be a string with Closure callback

You are calling the callback instead of passing the callback to when:

when($callback, $callback($query))

The second argument to when is a callback:

when($callback, $callback)

Though you shouldn't need this extra call to when since you can pass both the callbacks to the call to when:

$adminIds = Admin::when($callback, $callback, function ($query) use ($field, $value) { ... })
->pluck('id')->toArray();

"You may pass another closure as the third argument to the when method. This closure will only execute if the first argument evaluates as false."

Side Note: not sure where $value comes from in functionCallToCallback2

in my WordPress customized plugin Function name must be a string I am using $get_the_author_meta()

You have added a $ sign before get_the_author_meta() function.

This will be:

$xxx = get_the_author_meta('balance',$user_id);

Uncaught Error Function Name Must be a String, Log-in Form

Solution Here !!!

// Replace and work

$username = $_POST['username'];
$password = $_POST['password'];


Related Topics



Leave a reply



Submit