不能使用“ - ”变量名? [英] Cannot use "-" in variable names?

查看:92
本文介绍了不能使用“ - ”变量名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是错误:


<?php

$ super-man = 100;

?> ;


解析错误:解析错误,第2行/test.php中出现意外''=''


我明白了; - "标志被视为运营商。

有没有办法解决这个问题?我需要 - 变量名。


谢谢,

罗斯

The following gives an error:

<?php
$super-man=100;
?>

Parse error: parse error, unexpected ''='' in /test.php on line 2

I understand that the "-" sign is seen as an operator.
is there a way to get around this? I need to have "-" in variable names.

Thanks,
Ross

推荐答案

super- man = 100;

?>


解析错误:解析错误,第2行/test.php中的意外''=''

我理解 - 标志被视为运营商。

有没有办法解决这个问题?我需要 - 变量名。


谢谢,

罗斯
super-man=100;
?>

Parse error: parse error, unexpected ''='' in /test.php on line 2

I understand that the "-" sign is seen as an operator.
is there a way to get around this? I need to have "-" in variable names.

Thanks,
Ross


ross写道:
以下是错误:

<?php
The following gives an error:

<?php


super-man = 100;
?>

解析错误:解析错误,第2行/test.php中出现意外''=''

我理解 - 标志被视为运营商。
有没有办法解决这个问题?我需要 - 变量名。
super-man=100;
?>

Parse error: parse error, unexpected ''='' in /test.php on line 2

I understand that the "-" sign is seen as an operator.
is there a way to get around this? I need to have "-" in variable names.




不,你不能使用 - 登录变量。您可以使用_。


干杯,

Nicholas Sherlock



No, you cannot use the "-" sign in variables. You can use "_".

Cheers,
Nicholas Sherlock


这篇关于不能使用“ - ”变量名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆