0% found this document useful (0 votes)
8 views2 pages

PHP Practical 6

The document outlines a PHP programming assignment focused on demonstrating simple and parameterized functions. It includes definitions of default and parameterized functions, along with two example programs: one that adds two numbers and another that calculates the area of a rectangle. Each program is accompanied by its respective code and expected output.

Uploaded by

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

PHP Practical 6

The document outlines a PHP programming assignment focused on demonstrating simple and parameterized functions. It includes definitions of default and parameterized functions, along with two example programs: one that adds two numbers and another that calculates the area of a rectangle. Each program is accompanied by its respective code and expected output.

Uploaded by

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

Name: Shaikh Umar Class: CO6IB Batch: B1

Enroll: 2205690340 Subject: WBP Practical No:6

AIM: Write a simple PHP program to demonstrate the use of simple function and
parameterized function.
THEORY:
 Default Functions: These functions do not require any input values to operate.
They perform a set of actions based on their internal logic. For example, a
function that displays the current date and time would be considered a default
function as it doesn't need any external data to function.
 Parameterized Functions: These functions accept input values, known as
parameters or arguments, which influence their behaviour. These parameters
allow the function to be more flexible and adaptable to different situations. For
instance, a function that calculates the area of a rectangle would require
parameters for the length and width of the rectangle to perform the calculation
accurately.

PROGRAM 1:
AIM: PHP Program to use simple function

CODE:
<?php
function add(){
$a = 10;
$b = 20;
echo "Value of a: $a <br>";
echo "Value of b: $b <br>";
echo "Addition of two numbers: ", $a+$b;
}
add();
?>
OUTPUT:
PROGRAM 2:
AIM: PHP Program to use parameterized function

CODE:
<?php
function area($len, $bre){
echo "Length of the Rectangle : ", $len, "<br>";
echo "Breadth of the Rectangle : ", $bre, "<br>";
echo "Area of the Rectangle : ", $len*$bre;
}
area(4,5);
?>

OUTPUT:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy