Doc #72865 [Opn]: describe difference to echo (with example ideally)

From: Date: Wed, 17 Aug 2016 13:44:27 +0000
Subject: Doc #72865 [Opn]: describe difference to echo (with example ideally)
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-13827@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72865&edit=1 ID: 72865 Updated by: cmb@php.net Reported by: flashfee at gmx dot net Summary: describe difference to echo (with example ideally) Status: Open Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: The only relevant difference is that print accepts only one argument, while echo accepts a comma separated list of arguments. As of PHP 7.0.0 both statements compile to the same opcode, namely ZEND_ECHO, see <https://3v4l.org/lncp9/vld#output>. Formerly, they had different opcodes (ZEND_ECHO and ZEND_PRINT), but ZEND_PRINT forwarded to ZEND_ECHO, which might have made print slightly slower. Previous Comments: ------------------------------------------------------------------------ [2016-08-17 12:48:33] flashfee at gmx dot net Description: ------------ --- From manual page: http://www.php.net/function.print --- Both echo and print output a string. The similiarity and differences should be described. (syntax, performance, buffering, alias ..???) I use 'print' when I'm programming in Perl, I use echo when programming in PHP. Now I learned there is also 'print' in PHP? So can I just forget 'echo' and always use print? :-) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72865&edit=1

« previous php.doc.bugs (#13827) next »