WT Unit 5
WT Unit 5
Unit V PHP
Unit: 5
Introduction to PHP
Ankur Chaudhary
B.Tech, 3rd year Assistant Professor
Information Technology
Research Publications: 14
Grant Patent: 02
Patent: 06
12/13/2024 Ankur Chaudhary Web Technology UNIT 5 2
Contents
• Evaluation Scheme
• Syllabus
• Branch wise syllabus
• Course Objective
• Course Outcome
• Program Outcome
• CO-PO Mapping
• PSO
• CO- PSO Mapping
• PEO
• Result analysis
• Paper template
• Prerequisites
• Introduction to subject
• Unit objective
• Resource Sharing
• Server-Client model
• Communication Medium
• Access to remote information
• Person-to-person communication
• Electronic commerce
• Cloud-based Applications
• AI and Expert System
• Neural Networks and parallel programming
• Decision support and office automation systems etc.
• This course covers different aspect of web technology such as HTML, CSS, and
issues of web technology, client and server side issue. The general objectives of
this course are to provide fundamental concepts of Internet; Web Technology
and Web Programming. Students will be able to build a proper responsive
website.
1. Engineering knowledge
2. Problem analysis
3. Design/development of solutions
4. Conduct investigations of complex problems
5. Modern tool usage
6. The engineer and society
7. Environment and sustainability
8. Ethics
9. Individual and team work
10. Communication
11. Project management and finance
12. Life-long learning
Ankur Chaudhary Web Technology
/13/2024 13
UNIT 5
CO-PO Mapping
The highlighted text shows the mapping of course outcome with PO mapping
of this unit
Subject
Code is
Not
Assigne PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
d
3 2 2 1 1 1 1 1 3 3 2 3
3 2 3 1 3 2 2 1 3 3 3 3
3 2 3 2 3 2 2 2 3 3 2 3
3 3 3 2 3 2 2 2 3 3 2 3
3 3 3 2 3 2 2 2 3 3 2 3
Averag 2.4 2.8 1.6 2.6 1.8 1.8 1.6 3 3 2.2 3
e
3
12/13/2024 Ankur Chaudhary Web Technology UNIT 5 14
Program Specific Outcomes
The highlighted text shows the mapping of course outcome with PSO mapping
of this unit
Course Program Specific Outcomes
Outcomes
PSO1 PSO2 PSO3 PSO4
3 3 2 3
3 3 3 2
3 3 2 2
3 2 3 2
3 2 2 2
• PEO3: able to inculcate professional and social ethics, team work and
leadership for serving the society.
B TECH
(SEM-V) THEORY EXAMINATION 20__-20__
Time: 3 Hours Total Marks:
100
Note: 1. Attempt all Sections. If require any missing data; then choose
suitably.
SECTION A
1. Attempt all questions in brief. 1 x 10 = 10
Q.No. Question Marks CO
1 1
2 1
. .
10 1
SECTION B
3. Attempt any five part of the following: 5 x 6 = 30
1 6
. 6
7 6
12/13/2024 Ankur Chaudhary Web Technology 20
UNIT 5
End Semester Question Paper Template
1 10
2 10
5. Attempt any one part of the following: 1 x 10 = 10
Q.No. Question Marks CO
1 10
2 10
1 10
2 10
8. Attempt any one part of the following: 1 x 10 = 10
Q.No. Question Marks CO
1 10
2 10
• Web Technology refers to the various tools and techniques that are
utilized in the process of communication between different types of
devices over the internet.
• A web browser is used to access web pages. Web browsers can be defined
as programs that display text, data, pictures, animation, and video on the
Internet.
• Hyperlinked resources on the World Wide Web can be accessed using
software interfaces provided by Web browsers.
• https://www.youtube.com/results?
search_query=Web+Technonogies
• Read, understand and implement the PHP language in real world projects.
Topic objective
To discuss about basics of PHP with its syntax, variables and constants.
Topic objective
PHP data types are used to hold different types of data or values. PHP supports 8
primitive data types that can be categorized further in 3 types:
• Scalar Types (predefined)
• Compound Types (user-defined)
• Special Types
1 Scalar Types- It holds only single value. There are 4 scalar data types in PHP.
• boolean
• integer
• float
• string
2 Compound Types- It can hold multiple values. There are 2 compound data types
in PHP.
• array
• object
4 PHP switch statement is used to execute one statement from multiple conditions.
It works like PHP if-else-if statement.
• Syntax
– switch(expression){
– case value1:
– //code to be executed
– break;
– case value2:
– //code to be executed
– break;
– ......
– default:
– code to be executed if all cases are not matched;
– }
5 PHP for loop can be used to traverse set of code for the specified number of
times. It should be used if the number of iterations is known otherwise use while
loop. This means for loop is used when you already know how many times you want
to execute a block of code. It allows users to put all the loop related statements in
one place.
• Syntax
– for(initialization; condition; increment/decrement){
– //code to be executed
– }
6 PHP while loop can be used to traverse set of code like for loop. The while loop
executes a block of code repeatedly until the condition is FALSE. Once the condition
gets FALSE, it exits from the body of loop. It should be used if the number of
iterations is not known.
• Syntax
– while(condition){
– //code to be executed
– }
7 PHP do-while loop can be used to traverse set of code like php while loop. The
PHP do-while loop is guaranteed to run at least once. The PHP do-while loop is used
to execute a set of code of the program several times. If you have to execute the
loop at least once and the number of iterations is not even fixed, it is recommended
to use the do-while loop.
• Syntax
– do{
– //code to be executed
– }while(condition);
8 PHP break statement breaks the execution of the current for, while, do-while,
switch, and for-each loop. If you use break inside inner loop, it breaks the execution
of inner loop only. The break statement can be used in all types of loops such as
while, do-while, for, foreach loop, and also with switch case.
• Syntax
– jump statement;
– break;
Topic objective
• PHP function is a piece of code that can be reused many times. It can take input
as argument list and return value. There are thousands of built-in functions in
PHP.
• In PHP, we can define Conditional function, Function within
Function and Recursive function also.
• PHP User-defined Functions
• We can declare and call user-defined functions easily. Let's see the syntax to
declare user-defined functions.
• Syntax
– function functionname(){
– //code to be executed
– }
1 PHP Parameterized functions are the functions with parameters. You can pass any
number of parameters inside a function. These passed parameters act as variables
inside your function. They are specified inside the parentheses, after the function
name. The output depends upon the dynamic values passed as the parameters into
the function.
1 Single Quoted- We can create a string in PHP by enclosing the text in a single-
quote. It is the easiest way to specify string in PHP.
For specifying a literal single quote, escape it with a backslash (\) and to specify a
literal backslash (\) use double backslash (\\).
All the other instances with backslash such as \r or \n, will be output same as they
specified instead of having any special meaning.
PHP array is an ordered map (contains value on the basis of key). It is used to hold
multiple values of similar type in a single variable. We don't need to define multiple
variables. By the help of single loop, we can traverse all the elements of an array. We
can sort the elements of array. There are 3 types of array in PHP.
1 PHP indexed array is represented by number which starts from 0. We can store
number, string and object in the PHP array.
All PHP array elements are assigned to an index number by default. There are two
ways to define indexed array:
• 1st way:
• $season=array("summer","winter","spring","autumn");
• 2nd way:
• $season[0]="summer";
• $season[1]="winter";
• $season[2]="spring";
• $season[3]="autumn";
2 PHP associative array allows you to associate name/label with each array
elements in PHP using => symbol. Such way, you can easily remember the element
because each element is represented by label than an incremented number. There
are two ways to define associative array:
– 1st way:
– $salary=array("Sonoo"=>"550000","Vimal"=>"250000","Ratan"=>"200000");
– 2nd way:
– $salary["Sonoo"]="550000";
– $salary["Vimal"]="250000";
– $salary["Ratan"]="200000";
3 PHP multidimensional array is also known as array of arrays. It allows you to store
tabular data in an array. PHP multidimensional array can be represented in the form
of matrix which is represented by row * column.
– $emp = array
– (
– array(1,"sonoo",400000),
– array(2,"john",500000),
– array(3,"rahul",300000)
– );
Topic objective
To discuss about Understanding file& directory, Opening and closing, a file,
Coping, renaming and deleting a file, working with directories, Creating and
deleting folder, File Uploading & Downloading in PHP
Session variables solve this problem by storing user information to be used across
multiple pages (e.g. username, favorite color, etc). By default, session variables last
until the user closes the browser.
So; Session variables hold information about one single user, and are available to all
pages in one application.
Example
<?php
// Start the session
session_start();
?>
<!DOCTYPE html>
<html>
<body>
Syntax
setcookie(name, value, expire, path, domain, secure, httponly);
Syntax:
if(isset($_COOKIE[$cookie_name])) {
setcookie($cookie_name, "", time()-3600);
}
As the time() function returns the current time in seconds since Epoch, 3600
subtracted from it will return the past time. Finally, the cookie with the
$cookie_name is deleted. We can also use $cookie_name and null value in the
setcookie() function to delete the cookies.
if(isset($_COOKIE[$cookie_name])) {
setcookie($cookie_name, null);
}
Thus, we can use the setcookie() function to delete cookies in PHP.
– <?php
– session_destroy();
– ?>
11)Which of the following is the correct use of the strcmp() function in PHP?
A)The strcmp() function is used to compare the strings excluding case
B)The strcmp() function is used to compare the uppercase strings
C)The strcmp() function is used to compare the lowercase strings
D)The strcmp() function is used to compare the strings including case
TEXT BOOKS:
•(1.) Web Technologies, Black Book, Dreamtech Press.
•(2.) Internet and world wide web how to program, P.J. Deitel & H.M. Deitel, Pearson
•[3] Xavier, C,” Web Technology and Design”, New Age International.
REFERENCES:
• (1.) Ivan Bayross,”HTML, DHTML, JavaScript,Perl & CGI”, BPB Publication.
• (2.) Developing Web Applications, Ralph Moseley and M.T. Savaliya, Wiley-India
• (3.) Developing Web Applications in PHP and AJAX, Harwani, McGraw Hill.