哪个 php 配置变量不允许连接数组索引?
EG
if(!isset($am_states[$lot.'_-40C'])){
或
$am_states[$temp."_".$states[$i]['temperature']] = $states[$i]['temperature'];
每当我有带有连接字符串作为数组键的数组时,php 都会返回错误:
解析错误:语法错误,意外的“.”,期望“]”
所以我假设服务器出现问题配置,尽管我确信我更改了本地配置的某些内容。 上次我更改配置是在设置 apache/mysql/php 安装时
,即 PHP 版本 5.3.1、Apache/2.2.14、MYSQL5.1.41(默认来自 xampp1.7.3),
所以我在 7 个月前使用了此语法他们工作正常。只是现在他们产生了错误。 有人可以帮忙吗?
E.G.
if(!isset($am_states[$lot.'_-40C'])){
or
$am_states[$temp."_".$states[$i]['temperature']] = $states[$i]['temperature'];
Whenever I have arrays with concatenated string as array-keys php returns an error:
Parse error: syntax error, unexpected '.', expecting ']'
So I am assuming something is wrong with the server configuration although I am sure i changed something on my local configuration.
Last time i changed the configuration was when i setup my apache/mysql/php installation
that is PHP Version 5.3.1,Apache/2.2.14,MYSQL5.1.41 (default from xampp1.7.3)
so I was using this syntaxes 7 months ago and they were working properly. It just now that they produce errors.
Anyone can help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您对您正在使用的 PHP 版本确定吗?以下测试(使用 PHP 5.3.6 (cli))可以正常运行。也许您可以发布一个更完整的示例?
该脚本的输出是:
Are you positive about the PHP version you're using? The following test (using PHP 5.3.6 (cli)) works without issue. Perhaps you could post a more complete example?
The output of this script is: