diference between return , echo and print keyword in PHP

后端 未结 3 927
北恋
北恋 2021-01-12 19:56

What is the difference between these three?

return , echo and print keyword in PHP

function theBand($abc,$bac) {

return $abc;
echo $abc;

}
<         


        
3条回答
  •  星月不相逢
    2021-01-12 20:23

    return is a language construct used to exit a function and give a value to the caller of the function.

    echo and print are both language constructs that output strings. The main difference is that echo can take multiple arguments separated by commas, but print accepts only a single argument.

提交回复
热议问题