the difference of echo&print function

原创 2007年10月10日 17:39:00
There is a difference between the two, but speed-wise it should be 
irrelevant which one you use.  print() behaves like a function in that 
you can do:  $ret = print "Hello World";And $ret will be 1That means 
that print can be used as part of a more complex expression where echo 
cannot.  print is also part of the precedence table which it needs to 
be if it is to be used within a complex expression. It is just about at 
the bottom of the precendence list though.  Only "," AND, OR and XOR 
are lower.echo is marginally faster since it doesn't set a return value 
if you really want to get down to the nitty gritty.If the grammar is: 
echo expression [, expression[, expression] ... ]Then echo ( 
expression, expression ) is not valid.  ( expression ) reduces to just 
an expression so this would be valid: echo ("howdy"),("partner");but 
you would simply write this as: echo "howdy","partner"; if you wanted 
to use two expression.  Putting the brackets in there serves no purpose 
since there is no operator precendence issue with a single expression 
like that.

the difference of echo&print function

There is a difference between the two, but speed-wise it should be irrelevant which one you use. pr...
  • golden_chan
  • golden_chan
  • 2007年10月10日 17:39
  • 511


SOUNDEX 函数 [字符串]功能 返回表示字符串声音的数字。语法 SOUNDEX ( string-expression )参数 string-expression    字符串。用法 字符串的 ...
  • jimung
  • jimung
  • 2008年04月18日 03:12
  • 887

【翻译】【技术】Java入门:print(), println()和printf()的区别(翻译自treehouse问答)

  • antchen88
  • antchen88
  • 2017年02月23日 10:56
  • 182

codeforces 903 D. Almost Difference 线段树

Let’s denote a functionYou are given an array a consisting of n integers. You have to calculate the ...
  • wyz1251612514
  • wyz1251612514
  • 2017年12月19日 17:00
  • 65


  • aa574202228
  • aa574202228
  • 2015年12月15日 16:41
  • 1046


在3.0里print是个函数,我们通过输入help命令来获取当前print的使用方法: >>>help(print) Help on built-in function print in modul...
  • jinjinstudy
  • jinjinstudy
  • 2013年11月23日 08:10
  • 1108

Swift print 小技巧

Log 输出是程序开发中很重要的组成部分,虽然它并不是直接的业务代码,但是却可以忠实地反映我们的程序是如何工作的,以及记录程序运行的过程中发生了什么。 在 Swift 中,最简单的输出方法就是使...
  • magic_castle
  • magic_castle
  • 2015年12月30日 23:08
  • 3879

hackerrank>Dashboard>C++>STL>Print Pretty

Your manager gave you a text file with many lines of numbers to format and print. For each row of ...
  • lose__way
  • lose__way
  • 2017年06月10日 09:58
  • 217

Difference of Function and Sub

The easiest way to think of a sub vs a function is that a function can return a value and a sub cann...
  • tomiter
  • tomiter
  • 2011年10月02日 08:35
  • 353

Difference between Action and Function

Difference between Action and Function? ♦  Action is a collection of Vb statements in QTP. It doe...
  • BetterFate
  • BetterFate
  • 2013年04月16日 11:07
  • 276
您举报文章:the difference of echo&print function