PHP Syllabus
PHP Syllabus
1
References:
[1] Nixon, R. (2014). Learning PHP, MySQL, JavaScript, CSS & HTML5. 4th Edition, O'reilly.
[2] Welling, L., Thompson, L. (2008). PHP and MySQL Web Development. 4th Edition, Addison-
Wesley Professional.
Additional Resources:
2. Holzner, S. (2007). PHP: The Complete Reference. McGraw Hill Education (India).
3. Sklar, D., & Trachtenberg, A. (2014). PHP Cookbook: Solutions & Examples for PHP
Programmers. O'Reilly Media.
List of Practicals:
1) Write a PHP script to input three numbers and print the largest number.
2) Write a PHP code which accepts a number (from 1-12) as month value and displays the
number of days in that month. (Use Switch case).
3) Using switch case and dropdown list display a “Hello” message depending on the
language selected in the drop-down list.
4) Write a PHP script to find the sum of first n odd numbers.
5) Write a PHP script to check whether the given number is prime or not.
6) Write a PHP script to construct the following pattern, using nested for loop:
*
**
***
****
*****
7) Write a function to calculate the factorial of a number (non-negative integer), which accepts
the number as an argument.
8) Write a PHP script to accept a string from the user and print its reverse as output.
9) Write a PHP script to compare two variables using equality operator and identity operator.
2
10) Write a script to check if the input string consists of lowercase characters only.
11) Write a PHP script that checks if a string contains another string.
12) Write a PHP script to remove whitespaces from a string.
Sample string : The quick brown fox
Expected Output : Thequickbrownfox
13) Write a PHP script to replace the first ‘the’ of the following string with
‘That’. Sample : ‘the quick brown fox jumps over the lazy dog’.
Expected Output : ‘That quick brown fox jumps over the lazy dog’.
14) Write a PHP script to check whether a string is palindrome or not? (A palindrome is word,
phrase, or sequence that reads the same backward as forward, e.g., madam or nursesrun)
15) WAP to sort an array of numbers.
16) Create an array using a PHP script. Display the elements of this array in the form of a
bulleted list.
17) Write a PHP code which creates an array of 5 names. Display the names which start
with character “A”.
18) Create an associative array to store marks in five subjects of a student, where key is subject
name and value is marks in the subject. Display all keys and values. Also sort the array on
the basis of the key.
19) Write a PHP script to explode a string delimited with ## into an array. Print each element of
this array in the form of Array[index]= element.
Sample String: hello ## this ## is ## php ## programming
Expected Output: Array[0]=hello
Array[1]= this
Array[2]= is
Array[3]= php
Array[4]= programming
20) Create an HTML form with input elements: Name, Age, Address, Email and a submit button.