How to use function with parameter in PHP

In this article, I will explain how the function with parameter can be used in PHP.
  • 1977

Function with parameter in PHP

  • In function with parameter, pass parameters inside a function.
  • In function with parameter, you can pass as many as parameters your like. These parameters work like variables inside your function.
  • In function with parameter, a parameter appears with the parentheses "( )"


function functionname(parameters)
  code to be executed;


The following example takes two integer parameters and add them together and then print total.



<title>Function with Parameters</title>



<h2 style="color: steelblue;">Function with Parameters Loop example</h2>


    function add($num1, $num2)


    $total = $num1 + $num2;

    echo "Sum of the two numbers is : $total";


    add(90, 10);







You may also want to read these related articles here
Ask Your Question 
Got a programming related question? You may want to post your question here
© 2020 DotNetHeaven. All rights reserved.