Assign same value to multiple variables at once?

隐身守侯 提交于 2019-12-28 08:06:08

问题


How can I assign the same value for multiple variables in PHP at once ?

I have something like:

$var_a = 'A';
$var_b = 'A';
$same_var = 'A';
$var_d = 'A';
$some_var ='A';

In my case, I can't rename all variables to have the same name (that would make things more easy), so is there any way to assign the same value to all variables in a much more compact way?


回答1:


$var_a = $var_b = $same_var = $var_d = $some_var = 'A';


来源:https://stackoverflow.com/questions/11651594/assign-same-value-to-multiple-variables-at-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!