0% found this document useful (0 votes)
40 views4 pages

Aim: Write A Simple PHP Program To Demonstrate Use of Simple Function and

Uploaded by

Jagdeep Mehra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views4 pages

Aim: Write A Simple PHP Program To Demonstrate Use of Simple Function and

Uploaded by

Jagdeep Mehra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Class: CO6I – A/B Academic Year: 2020-2021

Experiment – 6
Title: Write a simple PHP program to demonstrate use of simple function
and parameterized function
Roll No.: 29 Name: Mehraan Khan

1. Aim: Write a simple PHP program to demonstrate use of simple function and
parameterized function

2. Requirements:
Personal Computer, Windows XP or above operating system, XAMPP (PHP,
APACHE, MYSQL), Microsoft Word

3. Theory:

Page 1 of 4
Page 2 of 4
Page 3 of 4
4. Program Code:
a. Write PHP script to calculate sum of two numbers with parameter and return value.
<?php
// Defining function
function getSum($num1, $num2){
$total = $num1 + $num2;
return $total;
}
// Printing returned value
echo "The Sum of Two Numbers :- ";
echo getSum(5, 10); // Outputs: 15
?>

b.Write PHP script to calculate cube of a number without parameter and return value.
<?php
function cube()
{
$no=8*8*8;
echo "The Cube without Parameter is:-";
echo $no;
}
cube();
?>

6. Conclusion: Hence we have learned write a simple PHP program to demonstrate use of
simple function and parameterized function.

Page 4 of 4

You might also like