php – 解析错误:语法错误,意外’未设置'(T_UNSET)

栏目: PHP · 发布时间: 7年前

内容简介:翻译自:https://stackoverflow.com/questions/21449551/parse-error-syntax-error-unexpected-unset-t-unset

我使用简单的php unset()函数来删除和索引数组,但它显示错误

Parse error: syntax error, unexpected 'unset' (T_UNSET)

错误.这是syntex

echo $totalArray  =     unset($linkExtHelp[0]);

提前致谢.

试试这个,未设置的原因($linkExtHelp [0])分配给变量echo $totalArray =

您不能将unset()值分配给变量,您可以在取消设置之前和未设置之后进行检查,如下所示.换句话说,unset没有任何返回值,因为unset是一个void. Void – 不向其调用者提供结果值.

语法:void unset(mixed $var [,mixed $…])

echo "Before unset:",$linkExtHelp[0];
unset($linkExtHelp[0]);
echo "After unset:",$linkExtHelp[0];

代替

echo $totalArray  =     unset($linkExtHelp[0]);

翻译自:https://stackoverflow.com/questions/21449551/parse-error-syntax-error-unexpected-unset-t-unset


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Usability for the Web

Usability for the Web

Tom Brinck、Darren Gergle、Scott D. Wood / Morgan Kaufmann / 2001-10-15 / USD 65.95

Every stage in the design of a new web site is an opportunity to meet or miss deadlines and budgetary goals. Every stage is an opportunity to boost or undercut the site's usability. Thi......一起来看看 《Usability for the Web》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具