PHP - Function Calling Functions

Introduction

To call a function, you write the function name, followed by an opening and a closing parenthesis:

functionName()

To pass arguments to the function, place them between the parentheses, separating each argument by commas:

functionName(argument)
functionName(argument1, argument2)

If a function returns a value, you can assign the value to a variable:

$returnVal = functionName(argument);

You can also pass the return value directly to another function, such as print() :

print(functionName(argument));

Demo

<?php
     echo"The square root of 9 is:". sqrt(9).". \n";
     echo"All done! \n";
?>/*from w  w w. j  av  a2  s  . c o  m*/

Result

Related Topic