1.PHP中有两个基本的输出方式:echo和print;

2.echo和print的区别:

**echo:可以输出一个或多个字符串;

**print:只允许输出一个字符串,返回值总为1;

3.echo是一个语言结构,使用的时候可以不用加括号,也可以加上括号:echo或echo()

<?php

echo "<h2>PHP is fun!</h2>";

echo "Hello world!<br>";

echo "I'm about to learn PHP!<br>";

echo "This"," string","was","made","with multiple parameters.";

?>

4.echo命令输出变量和字符串:

<?php

$txt1="Learn PHP";

$txt2="w3cshool.cc";

$cars=array("Volvo","BMW","Toyota");

echo $txt1;

echo "<br>";

echo "Study PHP at $txt2";

echo "My car is a {$cars[0]}";

?>

5.PHP的print语句:print同样是一个语言结构,可以使用括号,也可以不使用括号:print或print();

<?php

print "<h2>PHP is fun!</h2>";

print "Hello world!<br>";

print "I'm about to learn PHP!";

?>

PHP之echo/print的更多相关文章

  1. php中echo(),print(),print_r()之间的区别

    echo是PHP语句, print和print_r是函数,语句没有返回值,函数可以有返回值(即便没有用)  print只能打印出简单类型变量的值(如int,string)  print_r可以打印出复 ...

  2. php学习日志(3)-echo&print

    在php中,结果输出一共有两种方式:echo和print,下面将对两种方式做一个比较. echo与print的区别:   echo print 连续输出字符串 能连续输出多个字符串 只能输出一个字符串 ...

  3. PHP中echo,print(),print_r()的区别

    echo是 php 语句, print和print_r是函数,语句没有返回值,函数可以有返回值(即便没有用)    print() 只能打印出简单类型变量的值(如int,string) print_r ...

  4. php中echo(),print(),print_r()用法

    原文 php中echo(),print(),print_r()用法 从我对echo(),print(),print_r()这个函数的理解是echo可输入字符串变量常量,print与echo差不多,但p ...

  5. echo() print() printf() print_r() 的区别

    echo是一个语言结构而非函数,因此它无法被变量函数调用, print和print_r是函数,语句没有返回值,函数可以有返回值(即便没有用) print()    只能打印出简单类型变量的值(如int ...

  6. PHP里echo print print_r的区别

    echo ,print的区别在于echo 可以输出多个变量值,而print只有一个变量,做为一个字符串输出. 另一点区别在于echo 没有返回值,print有返回值1.print不能输出数组和对象. ...

  7. echo(),print(),print_r()之间的区别?

    echo是PHP语句, print和print_r是函数,语句没有返回值,函数可以有返回值(即便没有用)  print只能打印出简单类型变量的值(如int,string)  print_r可以打印出复 ...

  8. PHP中echo(),print(),print_r()之间的区别?

    echo是PHP语句, print和print_r是函数,语句没有返回值,函数可以有返回值(即便没有用) print只能打印出简单类型变量的值(如int,string) print_r可以打印出复杂类 ...

  9. php中echo(),print(),print_r(),var_dump()间的区别

    echo()函数:输出一个或多个字符串.实际上它并不是一个函数,所以不必对它使用括号,直接用echo就行.然而,如果您希望向echo()传递一个以上的参数,使用括号将会生成解析错误.echo()函数比 ...

  10. echo print() print_r() var_dump()的区别

    常用调试方法 echo()可以一次输出多个值,多个值之间用逗号分隔.echo是语言结构(language construct),而并不是真正的函数,因此不能作为表达式的一部分使用. print()函数 ...

随机推荐

  1. Android实现Banner界面广告图片循环轮播(包括实现手动滑动循环)

    前言:经常会看到有一些app的banner界面可以实现循环播放多个广告图片和手动滑动循环.本以为单纯的ViewPager就可以实现这些功能.但是蛋疼的事情来了,ViewPager并不支持循环翻页.所以 ...

  2. 【leetcode】Minimum Window Substring (hard) ★

    Given a string S and a string T, find the minimum window in S which will contain all the characters ...

  3. IOS - Objective-C NSArray和NSMutableArray的详解 使用

    原文地址:http://blog.csdn.net/totogo2010/article/details/7729377 Objective-C的数组比C++,Java的数组强大在于,NSArray保 ...

  4. IOS- 快速排序,冒泡排序,直接插入排序和折半插入排序,希尔排序,堆排序,直接选择排序

    /*******************************快速排序 start**********************************///随即取 当前取第一个,首先找到第一个的位置 ...

  5. sqlserver 导出数据字典

    -- 数据字典 SELECT ( then d.name else '' end)表名, a.colorder 字段序号, a.name 字段名, ( then '√'else '' end) 标识, ...

  6. tableView滚到最后一行

    dispatch_async(dispatch_get_main_queue(), ^{ [_tableview scrollToRowAtIndexPath:[NSIndexPath indexPa ...

  7. 在springMVC的controller层获取view层的参数的方式

    方法一:request.getParameter("name") 方法二:注解@RequestParam @RequestMapping("testRequestPara ...

  8. How many Fibs?【sudt 2321】【大数的加法及其比较】

    How many Fibs? Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Recall the definition of t ...

  9. windows操作技巧

    -------------------win7专有------------------- WIN+上下左右可以将当前窗口 最大化.左侧放置.右侧放置.最小化 WIN+Shift+左右是让窗口在多个屏幕 ...

  10. UVA 10828 Back to Kernighan-Ritchie(高斯消元)

    高斯消元求概率 对于非起点,期望x[i] = ∑x[j] / deg[j] #include<cstdio> #include<iostream> #include<cs ...