Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 想不到的在检查多个变量时_Php - Fatal编程技术网

Php 想不到的在检查多个变量时

Php 想不到的在检查多个变量时,php,Php,我需要检查多个变量,但出现以下错误: 分析错误:语法错误,意外“!”在第42行的/Applications/MAMP/htdocs/carematch3/includes/user.php中 第42行 if(!empty($firstname) && !empty($lastname) && !empty($email) && !empty($phone) !empty($gender) && !empty($dob)) {

我需要检查多个变量,但出现以下错误:

分析错误:语法错误,意外“!”在第42行的/Applications/MAMP/htdocs/carematch3/includes/user.php中

第42行

if(!empty($firstname) && !empty($lastname) && !empty($email) && !empty($phone) !empty($gender) && !empty($dob)) {
                $phaseOne = true;
            }
你的代码

if(!empty($firstname) && !empty($lastname) && !empty($email) && !empty($phone) !empty($gender) && !empty($dob)) {
            $phaseOne = true;
        }
我的代码:

if(!empty($firstname) && !empty($lastname) && !empty($email) && !empty($phone) **&&** !empty($gender) && !empty($dob)) {
            $phaseOne = true;
        }

请检查粗体更正中的语法错误

缺少“and”运算符
!空的($电话)!空($性别)
!空的($电话)!空($SEXT)
哦,哇,谢谢。。。我是多么的怀念,我永远也不会知道@BradFletcher如果您有一个长代码行,并且其中有一个错误,您可以始终将长代码行拆分为多行,因此错误消息将准确地告诉您错误在哪一行,然后您可以更好地知道错误在哪里。示例:
如果(!empty($firstname)&&
新行
!empty($lastname)&&
新行。。。