为什么我得到“只有变量应该通过引用传递"?错误? [英] Why am I getting "Only variables should be passed by reference" error?
本文介绍了为什么我得到“只有变量应该通过引用传递"?错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
查看此代码:
$last = end($p = explode('/', $someString));
收到此通知:
只有变量应该通过引用传递
Only variables should be passed by reference
我真的很困惑,因为 $p
是一个变量.
I'm really confused because $p
is a variable.
推荐答案
函数 end() 需要一个真正的变量而不是一个返回数组的函数,但是如果你把函数 return 放在双括号内 PHP 不会报告一个严格的标准通知:
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 ) ) );
这篇关于为什么我得到“只有变量应该通过引用传递"?错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文