Why am I getting "Only variables should be passed by reference" error?

pass-by-reference, php, variables

Solution

The function end() expects a real variable and not a function returning an array, but if you put the function return inside double parentheses PHP does not report a strict standards notice:

$last = end( ( explode( '/', $someString ) ) );

Problem

Check out this code: ``` $last = end($p = explode('/', $someString)); ``` Getting this notice: Only variables should be passed by reference I'm really confused because `$p` is a variable.

Original source

Related problems