Php:检查变量值是否作为变量存在 ||使变量值成为变量
是否可以使用变量值检查变量是否存在? 比如
//some variables:
$variable_a;
$variable_b;
$variable_c;
$variable_d;
$variable = '$variable_b';
if (the content $variable which is '$variable_b' exists == true){
}
或者如何将变量值变成变量? 就像
$variable = 'variable_name'; ...一些使“variable_name”成为变量的代码
Is it possible to check if a variable exist using a variable value?
Like
//some variables:
$variable_a;
$variable_b;
$variable_c;
$variable_d;
$variable = '$variable_b';
if (the content $variable which is '$variable_b' exists == true){
}
or how to make a variable value into a variable?
Like
$variable = 'variable_name';
...some code to make 'variable_name' a variable
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在 PHP 中使用 variable 变量,然后检查是否这样的变量有一个值。例如:
在屏幕上返回
Hello
。您还可以通过执行以下操作检查$variableA
是否有值:请注意,在您的问题中,您有没有值的变量,它们未设置。变量的全部目的是拥有一个值,因此得名,所以你的变量是某种僵尸,不是真正活着,也不是真正死了。它们尚未设置,因此
isset()
将返回false
。You can use variable variables in PHP, and then check if such a variable has a value. For instance:
returns
Hello
on your screen. You can also check if$variableA
has a value by doing:Note that in your question you have variables that have no value, they are not set. The whole purpose of variables is to have a value, hence their name, so your variables are some kind of zombies, not really alive, not really dead. They are not set, so
isset()
will returnfalse
.