What is function ? you have question right ? function is called reusable code that define one time we can use it many time, function save our time to do same time of job many time
Example
Function without argument :
<?php
function msg() {
echo "data saved";
}
msg(); // function call
?>
result : data saved
here if we need to print mesage data save after insert record. The same process for another record so it's good idea to make function and call the function
Function with argument :
<?php
function collegename($cname) {
echo "your college name is $cname.<br>";
}
collegename("sent joseph");
?>
Example
Function without argument :
<?php
function msg() {
echo "data saved";
}
msg(); // function call
?>
result : data saved
here if we need to print mesage data save after insert record. The same process for another record so it's good idea to make function and call the function
Function with argument :
<?php
function collegename($cname) {
echo "your college name is $cname.<br>";
}
collegename("sent joseph");
?>
result :
your college name is sent joseph.
Function With return arguments :
<?php
function sum($a,$b) {
return $a + $b;
}
echo sum(5,10);
?>
result : 15
No comments:
Post a Comment
your suggestion are welcome by me