Câu hỏi phỏng vấn PHP
Câu hỏi

Differentiate between echo and print()

Câu trả lời

Here is a detailed comparison of the echo and print() constructs in PHP:

Syntax

  • echo can take multiple arguments separated by commas, while print() takes only a single argument.
  • echo is a language construct, while print() is a function.

Return Value

  • echo does not return a value, while print() returns 1 so it can be used in expressions.

Speed

  • echo is slightly faster than print() because it doesn't return a value.

Usability

  • echo is more commonly used because it's a bit more flexible with its argument han...
junior

junior

Gợi ý câu hỏi phỏng vấn

junior

In PHP, objects are they passed by value or by reference?

middle

What are the exception class functions?

junior

What is the difference between var_dump() and print_r() ?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào