Heim  >  Artikel  >  Backend-Entwicklung  >  php 5.2.x 输出操作的细节

php 5.2.x 输出操作的细节

WBOY
WBOYOriginal
2016-07-25 08:55:39930Durchsuche
  1. $a = "hello";
  2. $b = "world";
  3. echo $a,$b,"
    ";
  4. echo $a.$b."
    ";
  5. print $a.$b;
复制代码

输出结果: helloworld helloworld helloworld

但这样则会出现编译错误:

  1. print $a,$b;
复制代码

注意:$a $b 中间的是逗号。 2、单引号跟双引号的区别:

  1. $a = "hello";
  2. $b = "world";
  3. echo "$a $b";
复制代码

输出:hello world

echo '$a $b'; 则输出:$a $b

以下这样也是可以正常输出的:

  1. $arr = array("a" => 1);
  2. echo $arr['a'];
复制代码


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn