Exforsys
+ Reply to Thread
Results 1 to 2 of 2

Return Value

This is a discussion on Return Value within the PHP forums, part of the Programming Talk category; I have tried many times echo() function in PHP. But since echo returns the value to screen I get a ...

  1. #1
    ashlee is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    108

    Return Value

    I have tried many times echo() function in PHP. But since echo returns the value to screen I get a doubt whether echo() function have a return value associated with it? If so what would be its type. Also if echo have a return value associated with it can we assign this to variable and use it in our PHP script further.


  2. #2
    rachelle is offline Member Array
    Join Date
    Apr 2006
    Answers
    97
    Both echo() and echo represents same thing in PHP. This is because of the simple fact that echo is not a function as many of us think. It is actually a language construct. Either syntax holds good and valid with respect to echo in PHP. Coming to your doubt of whether echo returns value. echo surely does not have any return value associated with it. Since it outputs the given
    expression or value on screen does not mean that it has return value associated with it. In fact this is the major difference between echo and print(). That is print() is a function and it has a return value associated with it which you can assign to a variable. But in contrast echo is not a function and is a language construct and also does not have a return value associated with it.


Latest Article

Network Security Risk Assessment and Measurement

Read More...