Searching...
Thursday, 4 October 2012

Function Overloading

11:04 pm

Function Overloading

Function Overloading :

1.      Cannot redeclare in a function in php.
2.      In other programing language programes if there exists more than one function with same name but with the different signatures the function calling signature should be matching with function definition signature. That means function overloading is happening through function calling and function deffinitions.
3.      In a php program it is not posible to redeclare a function. That means it is not possible to have more than one function with the same name in a single php programe, so function overloading is happening through function calling.
<?php
function display($x=0 , $y=0)
{
    echo $x."--".$y."<br>";
   
   
}
?>
<?php
echo "<h1>";
display("india","tech");
display(12, 20);
display(1, 2,3);
display("sunil");
display();
?>
Output:
      india--tech
      12--20      1--2      sunil--0      0—0

1 comments: