Aim Procedure and Source Code
Aim Procedure and Source Code
OR LOWER
Aim:
The aim of this PHP program is to determine whether a given character is uppercase or
lowercase.
Procedure:
Aim:
To create a PHP program that finds a specified word in a given text and displays the number of
occurrences.
Procedure:
4. Input field for the user to input the word they want to find.
Aim:
To create a PHP program that determines whether a given number is a palindrome or not.
Procedure:
4.Compare the original string with its reversed version to determine if they are identical
Aim:
To create a PHP program that tests and demonstrates 10 different string functions for
manipulating and processing strings.
Procedure:
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:
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.
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:
2.Create a PHP script that creates a new file and writes content to it using fopen, fwrite, and fclose.
Source Code
<?php
$path = "/PHP Program/TEN/index.php";
//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: