0% found this document useful (0 votes)
3 views

php_prac_6

The document contains PHP programming examples demonstrating the creation of different types of functions. It includes a simple function, a parameterized function for addition, a variable function that calls different functions based on a variable, and an anonymous function. Each example is accompanied by its output to illustrate the functionality.

Uploaded by

saeedarwatkar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

php_prac_6

The document contains PHP programming examples demonstrating the creation of different types of functions. It includes a simple function, a parameterized function for addition, a variable function that calls different functions based on a variable, and an anonymous function. Each example is accompanied by its output to illustrate the functionality.

Uploaded by

saeedarwatkar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Practical No.

6
1) Write a program to develop a simple function.
<?php

function display()

echo "Developing Simple Function<br>";

echo "Welcome to PHP Programming";

display();

?>

Output:
2) Write a program to develop a parameterized function.
<?php

function add($n1,$n2)

$n3=$n1+$n2;

echo "Developing Parameterized Function<br>";

echo "Addidtion of two numbers is $n3";

add(10,20);

?>

Output:
3) Write a program to develop a Variable function.
<?php

function sample()

echo "Hello<br>";

function data($args)

echo "HII $args";

$func='sample';

$func();

$func='data';

$func('Saee');

?>

Output:
4) Write a program to develop Anonymous Function.
<?php

$a=function()

echo "Anonymous Function";

};

$a();

?>

Output:

You might also like