0% found this document useful (0 votes)
28 views8 pages

User Defined Functions: Prointegra IT Solutions (P) LTD

This document discusses user defined functions in PHP. It provides examples of creating basic functions without parameters and with parameters. It also summarizes some common predefined PHP functions like empty(), is_numeric(), strlen(), strtoupper(), and strtolower(). The document encourages the user to create their own functions to embed a video file, find a factorial of a number, and add validation to a form.

Uploaded by

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

User Defined Functions: Prointegra IT Solutions (P) LTD

This document discusses user defined functions in PHP. It provides examples of creating basic functions without parameters and with parameters. It also summarizes some common predefined PHP functions like empty(), is_numeric(), strlen(), strtoupper(), and strtolower(). The document encourages the user to create their own functions to embed a video file, find a factorial of a number, and add validation to a form.

Uploaded by

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

User Defined Functions

PANKAJ
Prointegra IT Solutions (P) Ltd. Nagpur.
UDF(user defined functions) are the
function which r created by user as per
his own requirements.
Example : abc(), mysum().
<?PHP

function sayhi()
{
echo "Hi & Hello World ";
}

function ln()
{
echo "<br>=-==-=-==-=-==-=-==-=-==-=-==-=-= <br>";
}

ln();
echo "Welcome ";
sayhi();
ln();
?> Output
Functions with parameters.
<?PHP
function tot($A,$B)
{
$t=$A*$B;
return ($t);
}

echo "Tot is = ";


echo tot(5,8);
?>

Output : Tot is = 13
Predefined Function
empty() Function
<?php
$var;
// Evaluates to true because $var is empty
if (empty($var))
{
echo'$var is either 0,empty,or not set at all';
}
else
echo "There is Something...";
?>
is_numeric()
<?php

$x=hj;
if (is_numeric($x))
{
echo "is integer\n";
}
else
{
echo "is not an integer\n";
}
?>
Strlen()
<?php
echo strlen("Hello world!");
?>
O/p : 12

Strtoupper() & Strtolower()


<?php
echo strtoupper("Hello world!");
?>
O/p : HELLO WORLD!
U have 2 do..
• USE EMBED SRC TAG & CALL ANY
Video file in your web page by function.
Create a function to find factorial of a
given number.
Create a form with Numeric & Text
validation.

You might also like