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:

  1. blogger_logo_round_35
01 03 06 02 03a 04 05 7 8 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
Click to see the code!
To insert emoticon you must added at least one space before the code.