0% found this document useful (0 votes)
639 views4 pages

PHP Programming Syllabus 2024

This document outlines the topics and contents of a 6th semester B.Sc. Physical Science/Mathematical Science course on PHP programming. The course covers introduction to web application development, basics of PHP programming including variables, operators, and decision making. It also covers modular programming with functions and objects, strings and arrays, forms and form processing, and integrating PHP with databases. Twenty one practical programming assignments are listed related to conditions, loops, functions, strings, arrays, and databases. References for the textbook and additional resources are also provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
639 views4 pages

PHP Programming Syllabus 2024

This document outlines the topics and contents of a 6th semester B.Sc. Physical Science/Mathematical Science course on PHP programming. The course covers introduction to web application development, basics of PHP programming including variables, operators, and decision making. It also covers modular programming with functions and objects, strings and arrays, forms and form processing, and integrating PHP with databases. Twenty one practical programming assignments are listed related to conditions, loops, functions, strings, arrays, and databases. References for the textbook and additional resources are also provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

[Link].

Physical Science/Mathematical Science VIth Semester SEC


BSCS10B: PHP Programming

Topic Contents of Book Reference


Unit 1 - Introduction: Introduction Chapter 1, 2 (Only LAMP, XAMP [1]
to three tier web application and MAMP)
development, front end, business
layer and back end connectivity, role [Link]
of PHP in web application ultitier_architecture
development, software requirements.
Unit 2 - Starting PHP Chapter 3 (till [1]
Programming: Basics of PHP global variables))
programming, variables, scope of a
variable, expressions, operators, Chapter 4 ((till implicit
operator precedence, simple and explicit casting))
procedural scripts, decision making
based on conditions, case structure,
loops.
Unit 3 - Modular Programming: Chapter 5 ( pg 95-109) [1]
Functions and objects, Passing
parameters.
Unit 4 - Strings and Arrays: Chapter 6 (pg 123-128, 132-136) [1]
Creating and accessing strings, from [1]
built-in functions for string and [2]
string formatting, creating index Chapter 4(till pg 124) from [2]
based and associative array,
accessing array elements.
Unit 5 - Forms and form Chapter 11 (till page 283) [1] [1]
processing: Capturing form data,
GET and POST form methods, Chapter 4( pg 124-130) from [2] [2]
processing of form data, and use of
regular expressions.
Unit 6 - Integrating PHP & Chapter 10 (pg 234, 235, [1]
DBMS: Connecting PHP and 248-252)
DBMS, creating database, defining
database structure and accessing data
stored in tables using PHP.

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:

1. Boronczyk, T., & Psinas, M. E. (2008). PHP and MYSQL (Create-Modify-Reuse).

Wiley India Private Limited.

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:

(Use HTML forms for accepting input from user)

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.

Sample: $color = array(‘white’, ‘green’, ‘red’).

Expected Output : • white


• green
• red

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.

Write PHP scripts to perform following validations:


a. Name, Age, Address should not be left blank
b. Age should be greater than 18
c. Address should contain “Delhi”
d. Check whether the email entered is valid or not.
21) Write PHP scripts to
a. Create a database “CollegeWebsite”
b. create a table “User(username varchar(120), password varchar(10))” within
database “CollegeWebsite”.
c. Create a login page, which asks the user for a username and password. On clicking
submit, a welcome message should be displayed if the user is already registered (i.e.
name is present in the database) otherwise an error message should be displayed.

Common questions

Powered by AI

LAMP and XAMP stacks offer several advantages for PHP development, including being open-source and therefore cost-effective, widespread community support, cross-platform compatibility, and seamless integration of core components like Apache, MySQL, and PHP. These stacks simplify application deployment and management, providing a consistent and standardized setup suitable for various development tasks .

Functions and objects in PHP help in decomposing complex problems into smaller, manageable modules, enhancing code reusability and readability. Functions encapsulate specific tasks, while objects bundle data with relevant methods, fostering an organized codebase and easing maintenance and updates. This modular approach also facilitates unit testing and collaborative development .

The key difference between GET and POST methods in PHP form handling is how data is sent from the browser to the server. GET appends data to the URL, suitable for non-sensitive data retrieval and bookmarking URLs. POST sends data in the HTTP message body, supporting larger amounts of data and enhancing security for sending sensitive information. Use-cases for GET are primarily search queries, while POST is used for form submissions that modify server-side state .

PHP utilizes regular expressions for form validation by defining patterns that input data must match, ensuring data integrity and reducing user input errors. They are effective due to their flexibility in pattern matching, allowing complex and precise validation rules that can succinctly describe permissible input formats, thus enhancing security by filtering potentially harmful data inputs .

Global variables in PHP are accessible anywhere within the script after they are declared, while local variables are only accessible within the function or method they are defined in. This scope distinction impacts programming by limiting variable misuse and unintentional modification, thus promoting encapsulation in PHP. Since global variables persist across function calls, they can introduce bugs if not managed cautiously .

Integrating PHP with a DBMS involves: 1) Establishing a connection using PHP's database extensions like PDO or MySQLi, 2) Executing SQL queries to create a database and its structures, 3) Performing CRUD (Create, Read, Update, Delete) operations by sending appropriate SQL statements, and 4) Accessing and manipulating data stored within tables through PHP referencing connections and query results to dynamically generate content .

Operator precedence in PHP dictates the order in which parts of an expression are evaluated, influencing results by determining operation hierarchy akin to mathematical precedence rules. Implicit casting automatically converts variables between types based on operation requirements, potentially leading to unintended behavior in expressions. Explicit casting allows developers to control type conversion intentionally, ensuring the desired evaluation sequence and results .

The main role of PHP in developing multi-tier web applications is to handle the business logic and server-side functionalities. PHP processes input from the front-end, interacts with the database as a back-end tool, and returns dynamic content generated by the server back to the client. It enables the separation of concerns by dividing application structure into presentation, business, and data layers, facilitating easier maintenance and scalability .

PHP's case structure involves using 'if-else' statements to evaluate conditions sequentially, which is useful when conditions are not uniform or involve complex expressions. The switch statement provides a more efficient and readable way to handle multiple comparison cases with the same variable, particularly when only equality checks are involved, making it less prone to errors and faster in execution compared to nested 'if-else' chains .

PHP allows creation and management of associative arrays by mapping unique keys to values instead of using numeric indices, enabling more intuitive and human-readable code. Associative arrays are advantageous over indexed arrays for storing data with explicit identifiers like user properties, thus easing access and manipulation of data within applications .

You might also like