PHP TutorialLesson 7Free preview
PHP Echo / Print
This lesson is part of PHP · All levels
Summary
This lesson discusses the two main ways of presenting data in PHP, namely echo and print. Echo is more often used because it can accept multiple arguments at once, whereas print only accepts one argument and returns the value. You also learn how to combine text with the point operator (concatenation).
Key points
- Echo is the most common construct and can accept more than one argument
- Print is a function that returns a value and only accepts one argument
- Operator. Used to combine two strings.
- Always escape the output of the user with htmlspecialchars() to prevent XSS
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.