[wp-trac] [WordPress Trac] #13399: Code Improvement: Consider print instead of echo

WordPress Trac wp-trac at lists.automattic.com
Sat May 15 12:05:51 UTC 2010


#13399: Code Improvement: Consider print instead of echo
--------------------------+-------------------------------------------------
 Reporter:  hakre         |       Owner:     
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.1
Component:  General       |     Version:  3.0
 Severity:  normal        |    Keywords:     
--------------------------+-------------------------------------------------

Comment(by filosofo):

 Replying to [ticket:13399 hakre]:
 > Instead of calling a function it is better use the intended language
 construct for doing output: print

 Could you clarify your point?  According to the PHP doc at your `echo`
 link:
  echo() is not actually a function (it is a language construct), so you
 are not required to use parentheses with it. echo() (unlike some other
 language constructs) does not behave like a function

 Also, I've read in several places over the years that `echo` is faster
 than `print`, although I haven't tested it myself.  `echo` does seem to be
 the most common choice across a wide variety of PHP applications.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13399#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list