这是我的代码:
if($number == 1){
$output-number = "output";
}
但每次我都会收到一条错误消息:syntax error, unexpected '='
,我不知道为什么。我现在找了很长时间,但没有找到有用的答案。
PHP不允许减号作为变量名的一部分。使用下划线,即将$output-number
更改为$output_number
。或者使用驼色大小写样式:$outputNumber
。
更改为
$output_number = "output";