如何访问名称中包含空格的变量?
PHP 如何处理这样的事情:
$blah = "Testing a variable";
$$blah = "test";
我将如何访问动态声明的变量?
How does PHP handle something like this:
$blah = "Testing a variable";
$blah = "test";
What would I access my dynamically declared variable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有关变量的所有信息,请访问 http://www.php。 net/manual/en/language.variables.variable.php,除了一件事:不要使用它们。
Everything you need to know about variable variables at http://www.php.net/manual/en/language.variables.variable.php, except for one thing: don't use them.
echo ${'测试变量'};
但是,您不想在实践中这样做。它会导致代码难以维护且容易出现错误。
echo ${'Testing a variable'};
However, you don't want to do this in practice. It makes for unmaintainable, bug-prone code.
变量
$blah
必须包含有效的变量名称。这将告诉您有关变量的信息: http://www.php.net/手册/en/language.variables.basics.php
The variable
$blah
must contain a valid variable name.This will tell you about variables: http://www.php.net/manual/en/language.variables.basics.php
并不是真正的答案,但是......
Not really an answer, but...