0% found this document useful (0 votes)
4 views5 pages

Unit 1 Note Dynamic Web

The document provides an introduction to PHP and web application basics, covering topics such as web applications, client-side vs server-side scripting, and web servers. It details PHP fundamentals, including variables, data types, operators, control statements, and arrays, essential for dynamic web development. The document also includes instructions for setting up a local server using XAMPP.

Uploaded by

garvaquarius
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)
4 views5 pages

Unit 1 Note Dynamic Web

The document provides an introduction to PHP and web application basics, covering topics such as web applications, client-side vs server-side scripting, and web servers. It details PHP fundamentals, including variables, data types, operators, control statements, and arrays, essential for dynamic web development. The document also includes instructions for setting up a local server using XAMPP.

Uploaded by

garvaquarius
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

BCA 203T – Dynamic Web Designing

Unit I: Introduction to PHP & Web Application Basics

1. Introduction to Web Applications


A Web Application is a software program that runs on a web server and can be ac-
cessed using a web browser. Examples include Gmail, Facebook, Online Banking, and
E-commerce sites like Amazon.

Features
• Accessible through any web browser.

• Platform independent.

• Easy to maintain and update.

2. Client Side vs Server Side Scripting


Client-Side Scripting Server-Side Scripting
Runs on the browser. Runs on the server.
Languages: HTML, CSS, JavaScript. Languages: PHP, JSP, [Link].
Cannot access databases. Can access databases and files.
Used for validation and interactivity. Used for data processing and dynamic
content.

3. Web Servers
A Web Server hosts and serves web pages.

Local Server
Installed locally for development. Examples: WAMP, LAMP, XAMPP, MAMP.

Remote Server
Hosted online and accessible via domain name. Examples: AWS, Hostinger, GoDaddy.

4. Installation (XAMPP Example)


1. Download XAMPP from [Link].

2. Install and start Apache and MySQL.

3. Save project in htdocs/.

4. Open [Link]

1
5. Static vs Dynamic Websites
Static Website Dynamic Website
Same content for all users. Content changes dynamically.
HTML, CSS only. Uses PHP, JSP, or database.
Example: Portfolio site. Example: Facebook, Amazon.

6. Introduction to PHP
PHP (Hypertext Preprocessor) is a server-side scripting language used for dynamic
web development.

Advantages
• Open-source and platform independent.

• Easy to integrate with databases.

• Fast and flexible.

Example
<? php
echo " Hello , ␣ World ! " ;
?>

7. PHP Variables and Data Types


Variables are declared with a $ symbol.
<? php
$name = " Durgesh " ;
$age = 25;
$marks = 87.5;
$isPass = true ;
echo " Name : ␣ $name , ␣ Age : ␣ $age " ;
?>

Data Types: String, Integer, Float, Boolean, Array, Object, NULL.

8. Constants and Comments


<? php
define ( " COLLEGE " , " IP ␣ University " ) ;
echo COLLEGE ;

// Single line comment


# Another single line

2
/*
Multi - line comment
*/
?>

9. Operators
• Arithmetic: +, -, *, /, %
• Assignment: =, +=, -=
• Comparison: ==, !=, ===
• Logical: , ——, !
• String: ., .=

<? php
$a = 10; $b = 5;
echo $a + $b ; // Output : 15
?>

10. Regular Expressions


Used for pattern matching in strings.
<? php
$pattern = " /^[ A - Za - z ]+ $ / " ;
if ( preg_match ( $pattern , " Durgesh " ) )
echo " Valid ␣ Name " ;
else
echo " Invalid " ;
?>

11. Control Statements


If-Else
<? php
$marks = 75;
if ( $marks >= 90)
echo " A ␣ Grade " ;
elseif ( $marks >= 75)
echo " B ␣ Grade " ;
else
echo " C ␣ Grade " ;
?>

3
Switch Case
<? php
$day = 3;
switch ( $day ) {
case 1: echo " Monday " ; break ;
case 2: echo " Tuesday " ; break ;
case 3: echo " Wednesday " ; break ;
default : echo " Invalid " ;
}
?>

Loops
For Loop
for ( $i =1; $i <=5; $i ++)
echo " Number : ␣ $i < br > " ;

While Loop
$i = 1;
while ( $i <= 3) {
echo " Hello < br > " ;
$i ++;
}

Do-While Loop
$i = 1;
do {
echo " Count : ␣ $i < br > " ;
$i ++;
} while ( $i <= 3) ;

Foreach Loop
$colors = array ( " Red " , " Green " , " Blue " ) ;
foreach ( $colors as $c )
echo " $c < br > " ;

12. Arrays in PHP


Indexed Array
$fruits = array ( " Apple " , " Banana " , " Mango " ) ;
echo $fruits [1]; // Banana

4
Associative Array
$marks = array ( " Amit " = >90 , " Riya " = >80) ;
echo $marks [ " Riya " ];

Multidimensional Array
$students = array (
array ( " Amit " , 90) ,
array ( " Riya " , 85) ,
array ( " John " , 80)
);
echo $students [1][0]; // Riya

Predefined Array Functions


$numbers = array (10 , 20 , 30) ;
echo count ( $numbers ) ;
sort ( $numbers ) ;
print_r ( $numbers ) ;
array_push ( $numbers , 40) ;

Conclusion
This unit introduces PHP fundamentals, local server setup, control structures, and ar-
rays—core concepts for building dynamic web applications.

You might also like