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

Aim Procedure and Source Code

Uploaded by

Mohan Raj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
14 views8 pages

Aim Procedure and Source Code

Uploaded by

Mohan Raj
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 8

EXERCISE 5: WRITE A PHP PROGRAM TO FIND GIVEN CHARACTER IS UPPER

OR LOWER

Aim:

The aim of this PHP program is to determine whether a given character is uppercase or
lowercase.

Procedure:

1 OpenNotepad++and type respective PHP program code.

2. Retrieve the character input from the user.

3. Check if the input is exactly one character.

4.Ensure the input is alphabetic (A-Z or a-z).

5.Save it in Local disk C:WAMP-WWW.


6.Launch WAMP server and click on local host
7.Click on your program from index

EXERCISE 6: WRITE A PHP PROGRAM TO FIND A WORD IN A GIVEN TEXT

Aim:

To create a PHP program that finds a specified word in a given text and displays the number of
occurrences.

Procedure:

1.OpenNotepad++and type respective PHP program code.

2. Text area for the user to input the text

3. Display the count of occurrences to the user.

4. Input field for the user to input the word they want to find.

5.Save it in Local disk C:WAMP-WWW.


6.Launch WAMP server and click on local host
7.Click on your program from index
EXERCISE 7: WRITE A PHP PROGRAM TO CHECK GIVEN NUMBER IS
PALIDROME OR NOT

Aim:

To create a PHP program that determines whether a given number is a palindrome or not.

Procedure:

1.OpenNotepad++and type respective PHP program code.

2.Convert the number to a string to facilitate easy reversal.


3. Reverse the string representation of the number.

4.Compare the original string with its reversed version to determine if they are identical

5. Save it in Local disk C:WAMP-WWW.


6.Launch WAMP server and click on local host
7.Click on your program from index
EXERCISE 8: WRITE A PHP PROGRAM TO TEST 10 STRING FUNCTIONS

Aim:

To create a PHP program that tests and demonstrates 10 different string functions for
manipulating and processing strings.

Procedure:

1.OpenNotepad++and type respective PHP program code.

2. Start by defining a sample string that will be used for testing the string functions.
3. Use a variety of PHP string functions to manipulate and process the sample string.
4. Each function should demonstrate a unique aspect of string handling in PHP
5. Save it in Local disk C:WAMP-WWW.
6.Launch WAMP server and click on local host
7.Click on your program from index

Source Code
<?php
echo"<br>";
echo strlen("Hello world!"); // outputs 12
echo"<br>";
echo str_word_count("Hello world!"); echo"<br>";
echo strrev("Hello world!");echo"<br>";
echo strpos("Hello world!", "world");echo"<br>";
echo str_replace("world", "Dolly", "Hello world!");echo"<br>";
echo strstr("Hello world!","world");echo"<br>";
echo strtolower("Hello WORLD."); echo"<br>";
echo strtolower("Hello WORLD.");echo"<br>";
echo strtoupper("Hello WORLD!");echo"<br>";
echo substr("Hello world",6);echo"<br>";
$str = "Hello World!";echo"<br>";
echo trim($str,"Hed!");echo"<br>";
?>
Output
EXERCISE 9: WRITE A PHP PROGRAM TO DESIGN HOME PAGE FOR COLLEGE

Aim:

To create a basic PHP program that designs the home page for a college website.

Procedure:

1. OpenNotepad++and type respective PHP program code.

2. The home page using HTML, including sections for header, navigation, main content, and footer.

3. Use CSS to style the page layout, fonts, colors, and any visual elements to create an appealing design.

4. Save it in Local disk C:WAMP-WWW.


5.Launch WAMP server and click on local host
6.Click on your program from index

Source Code
<html>
<title>BHC</title>
<head></head>

<body style="background-color:#A8A8A8;">

<div style="width:100%;height:50px;background-color:#d388F8;">
<div style="width:40%;float:left;">
<div style="width:10%;float:left;">
<img src="logo.jpg" width="50" height="50"/>
</div>
<div style="width:30%;float:left;">
<p style="color:#FFFFFF;float:center;margin-top:5px;">BISHOP HEBER COLLEGE</p>
</div>
</div>

<div style="width:60%;float:left;">
<a href="../EIGHT/index.php" style="margin-left:10px;">Home</a>
<a href="http://www.google.com" style="margin-left:10px;">About Us</a>
<a href="" style="margin-left:10px;">Contact Us</a>
<a href="" style="margin-left:10px;">Career</a>

</div>

</div>
<div style="width:100%;height:500px;background-color:#D9D9D9;">
<center>
<img src="back.jpg" style="margin-top:15px;"/></center>

</div>

<div style="width:100%;height:50px;background-color:#808080;">

</div>

</body

></html>

Output
EXERCISE 10: WRITE A PHP PROGRAM FOR FILE SYSTEM FUNCTIONS,
NETWORK FUNCTION AND DATE AND TIME FUNCTION

Aim:

To create a PHP program that demonstrates the usage of file system functions, network
functions, and date/time functions.

Procedure:

1. OpenNotepad++and type respective PHP program code.

2.Create a PHP script that creates a new file and writes content to it using fopen, fwrite, and fclose.

3.Read from an existing file using fopen, fread, and fclose.

4.Perform operations like adding days to a date using strtotime

5. Save it in Local disk C:WAMP-WWW.


6.Launch WAMP server and click on local host
7.Click on your program from index

Source Code
<?php
$path = "/PHP Program/TEN/index.php";

//Show filename with file extension


echo basename($path) ."<br/>";

//gethost address by ip
echo gethostbyaddr('216.239.115.148');
echo gethostbyname('techrepublic.com');
$date = date('m/d/Y h:i:s a', time());
echo $date;

?>
Output:

You might also like