码迷,mamicode.com
首页 > Web开发 > 详细

PHP函数

时间:2017-04-04 09:44:55      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:使用   blog   struct   str   int   结束   初始化   没有   echo   

1、构造函数
用于在创建对象时初始化对象,总是与new操作符一起使用
function __construct($x, $y){   $this->a = $x;   $this->b = $y; }
2、构析函数
在对象声明周期结束时,系统自动执行构析函数,执行释放空间等操作 function __destruct(){   echo("<br>" . “对象被销毁了"); }

2、echo和print的区别

echo - 可以输出一个或多个字符串

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

echo输出的速度比print快,echo没有返回值print有返回值1

两个函数中都可以添加HTML元素


echo输出一个字符串

echo("a" . "  " . “string”);

echo("a" . "<br>" . "string");


echo输出多个字符串

echo "a", "--", “string";


 

 

PHP函数

标签:使用   blog   struct   str   int   结束   初始化   没有   echo   

原文地址:http://www.cnblogs.com/jiaoxuanwen/p/6662103.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!