difference between echo and print in php

Posted on 2010-03-01 13:06  FreeSkyCD  阅读(129)  评论(0编辑  收藏  举报

阅读: 17 评论: 0 作者: looping 发表于 2010-03-01 13:06 原文链接

Echo
The simplest use of echo is to print a string as argument, for example:
echo “This will print in the user’s browser window.”;
Or equivalently:
echo(“This will print in the user’s browser window.”);

Both of these statements will cause the given sentence to be displayed, without displaying
the quote signs. (Note for C programmers: Think of the HTTP connection to the user as the
standard output stream for these functions.)
You can also give multiple arguments to the unparenthesized version of echo, separated by
commas, as in:
echo “This will print in the “, “user’s browser window.”;
The parenthesized version, however, will not accept multiple arguments:
echo (“This will produce a “, “PARSE ERROR!”);
Print
The command print is very similar to echo, with two important differences:
✦ Unlike echo, print can accept only one argument.
✦ Unlike echo, print returns a value, which represents whether the print statement succeeded.

The value returned by print will be 1 if the printing was successful and 0 if unsuccessful.

评论: 0 查看评论 发表评论

找优秀程序员,就在博客园


最新新闻:
· IBM发布第五代X架构 打破X86系统30年技术局限(2010-03-03 22:47)
· 互联网手机业务成香馍馍 上海电信盯牢3G市场(2010-03-03 22:38)
· Twitter信息总量即将突破100亿条大关(2010-03-03 22:34)
· Opera为何无法进一步拓展市场(2010-03-03 21:38)
· Symbian版 Skype登陆诺基亚Ovi Store(2010-03-03 21:04)

编辑推荐:Opera为何无法进一步拓展市场

网站导航:博客园首页  个人主页  新闻  闪存  小组  博问  社区  知识库

Copyright © 2024 FreeSkyCD
Powered by .NET 8.0 on Kubernetes