Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.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 为什么echo不打印文本的第一部分_Php_Echo - Fatal编程技术网

Php 为什么echo不打印文本的第一部分

Php 为什么echo不打印文本的第一部分,php,echo,Php,Echo,为什么只打印“-1”。课文的第一部分发生了什么 echo "2 results of this " . "Apples" <=> "bananas"; echo“这两个结果”。“苹果”“香蕉”; 谢谢比具有更高的优先级,因此它被解析为您编写的: echo ("2 results of this " . "Apples") <=> "bananas"; echo(“这两个结果”。“苹果”)“香蕉”; 这相当于: echo "2 results of this

为什么只打印“-1”。课文的第一部分发生了什么

echo "2 results of this " .    "Apples" <=> "bananas";
echo“这两个结果”。“苹果”“香蕉”;

谢谢

具有更高的优先级,因此它被解析为您编写的:

echo ("2 results of this " . "Apples") <=> "bananas";
echo(“这两个结果”。“苹果”)“香蕉”;
这相当于:

echo "2 results of this Apples" <=> "bananas";
echo“2个苹果”“香蕉”的结果;
它比较这两个字符串并打印结果

添加括号以获得所需内容:

echo "2 results of this " . ("Apples" <=> "bananas");
echo“这两个结果”。(“苹果”“香蕉”);

具有更高的优先级,因此它被解析为您编写的:

echo ("2 results of this " . "Apples") <=> "bananas";
echo(“这两个结果”。“苹果”)“香蕉”;
这相当于:

echo "2 results of this Apples" <=> "bananas";
echo“2个苹果”“香蕉”的结果;
它比较这两个字符串并打印结果

添加括号以获得所需内容:

echo "2 results of this " . ("Apples" <=> "bananas");
echo“这两个结果”。(“苹果”“香蕉”);

,因为它将首先连接字符串,然后应用spaceship运算符比较

"

2此操作的结果”。“苹果”“香蕉”=-1.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      ^^^^^^^^^
第1条第2条
试试下面

  $spaceship_result=  "Apples" <=> "bananas";
  echo "2 results of this ".$spaceship_result;
$spaceship\u result=“苹果”“香蕉”;
回显“这2个结果”。$spaceship_结果;

,因为它将首先连接字符串,然后应用spaceship运算符比较

"

2此操作的结果”。“苹果”“香蕉”=-1.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      ^^^^^^^^^
第1条第2条
试试下面

  $spaceship_result=  "Apples" <=> "bananas";
  echo "2 results of this ".$spaceship_result;
$spaceship\u result=“苹果”“香蕉”;
回显“这2个结果”。$spaceship_结果;
回显“这两个结果”。(“苹果”“香蕉”);
这是一种方法

回显“2个结果”。(“苹果”“香蕉”);

这是一种方法

使用括号括住
(“苹果”“香蕉”)
非常感谢Barmar.和Sumit以及所有善意回答我问题的人。使用括号括住
(“苹果”“香蕉”)
非常感谢Barmar.和Sumit以及所有善意回答我问题的人。如果你的回答不能解决OP的问题,那么他必须更好地解释他的问题。我只是想知道“这个的2个结果-1”在哪里被使用lol。但是是的,OP,sumit的答案解决了你的问题。如果你的答案不能解决OP的问题,那么他必须更好地解释他的问题。我只是想知道“这个的2个结果-1”在哪里被使用lol。但是是的,OP,sumit的答案解决了你的问题。