240101066_module_2 V2
240101066_module_2 V2
KESHARI
2024 -2028{CSE}
MODULE:2 ASSIGNMENT
PROFESSOR NAME :
UJJAWAL BISWAS
INTRODUCTION TO PHP:
a.Why do we use PHP ?
smoother
development
cloud provide
compatibility security
resourceful 1.Why
Dynamic
community we use structure
and support
PHP
easy to use in
open sources web
development
server
support side
printing
b.Application of PHP :-
Data
representation
Graphics
Design and Web content
image management
processing
Application
Create flash of PHP
based design web
animation based
Graphics user application
interface
E -commerece
Dash board
Application
C.HISTORY OF PHP :-
PHP started out as a small open-source project that evolved gradually as more and more
people found out how useful it was. Rasmus Lerdorf released the first version of PHP
way back in 1994. At that time, PHP stood for Personal Home Page, as he used it to
maintain his personal homepage. Later on, he added database support and called it as
"Personal Home Page/Forms Interpreter" or PHP/FI, which could be used to build
simple, dynamic web applications.
Zeev Suraski and Andi Gutmans rewrote the parser in 1997 and formed the base of PHP
3. The name of the language was also changed to the recursive acronym PHP: Hypertext
Preprocessor. They are also the authors of Zend Engine, a compiler and runtime
environment for the PHP. Zend Engine powered PHP 4 was released in May 2000.
• PHP 5 was released in 2004, which included many new features such as OOP support, the PHP
Data Objects (PDO), and numerous performance enhancements.
• PHP 7, is a new major PHP version which was developed in 2015. It included new language
features, most notable being, the introduction of return type declarations for functions which
complement the existing parameter type declarations, and support for the scalar types (integer,
float, string, and boolean) in parameter and return type declarations.
d. Version of PHP :-
Now we have configured the installation and we can write the changes, so it
prompts us for final question whether it can install Xampp on the System for
the configuration.
Click on Forward to accept the changes, in case you need to change anything
cancel it and start from the beginning.
Feel free to uncheck the Launch Xampp checkbox, we will see how we can
start Xampp in the next step.
Finally Click on Finish to complete the Setup process.
uninstalling xampp
In the above image, you can refer that its being uninstalled. Once the progress is
over, you can close the terminal window.
Conclusion
In this article we have seen step by step procedure of installing Xampp, a easy to
install suite of software that comes as a single package for Apache server, Maria
DB, PHP. We have also seen how to uninstall it incase we need to completely
remove the software from the System.
e.Variables in PHP :
In PHP, data types are essential as they define the type of data a variable can store.
PHP supports several primitive data types that can be categorized into three main
types: Scalar Types, Compound Types, and Special Types.
Scalar Types
Scalar types in PHP are those that represent a single value. There are four scalar
data types:
Boolean: Represents two possible states, TRUE or FALSE. It is often used in
conditional statements to represent the outcome of an expression.
Integer: Represents whole numbers, both positive and negative, without any
decimal points. Integers can be in decimal, octal, or hexadecimal form.
Float (or double): Represents numbers with a decimal point or in exponential
form. Unlike integers, floats can represent fractional numbers.
String: Represents a sequence of characters and can include letters, numbers,
and special characters. Strings must be enclosed in quotes, either single or
double.
e.Operators in PHP:
Operators are used to performing operations on some values. In other words, we
can describe operators as something that takes some values, performs some
operation on them, and gives a result. From example, “1 + 2 = 3” in this expression
‘+’ is an operator. It takes two values 1 and 2, performs an addition operation on
them to give 3.
Just like any other programming language, PHP also supports various types of
operations like arithmetic operations(addition, subtraction, etc), logical
operations(AND, OR etc), Increment/Decrement Operations, etc. Thus, PHP
provides us with many operators to perform such operations on various operands
or variables, or values. These operators are nothing but symbols needed to perform
operations of various types. Given below are the various groups of operators:
Arithmetic Operators
Logical or Relational Operators
Comparison Operators
Conditional or Ternary Operators
Assignment Operators
Spaceship Operators (Introduced in PHP 7)
Array Operators
Increment/Decrement Operators
String Operators
f. String in PHP:
A string is a sequence of characters, like 'PHP supports string operations.' A string
in PHP as an array of bytes and an integer indicating the length of the buffer. In
PHP, a character is the same as a byte. This means that PHP only supports a 256-
character set, and hence does not offer native Unicode support.
PHP supports single quoted as well as double quoted string formation. Both the
representations 'this is a simple string' as well as "this is a simple string" are valid.
PHP also has Heredoc and Newdoc representations of string data type.
g.Comments in PHP :
i.Loops in PHP:
3.Advanced features in PHP :
a. Array in PHP :
An array is a special variable that can hold many values under a single name, and you
can access the values by referring to an index number or name.
Array Items
Array items can be of any data type.
The most common are strings and numbers (int, float), but array items can also be
objects, functions or even arrays.
You can have different data types in the same array.
b.functions in PHP:
c.Form handling in PHP:
HTML Forms play an important role in PHP web applications. Although a webpage
composed purely with HTML is a static webpage, the HTML form component is an
important feature that helps in bringing interactivity and rendering dynamic content.
PHP’s form handling functionality can validate data collected from the user, before
processing.
An HTML Form is a collection various form controls such as text fields, checkboxes,
radio buttons, etc., with which the user can interact, enter or choose certain data that
may be either locally processed by JavaScript (client-side processing), or sent to a
remote server for processing with the help of server-side programming scripts such as
PHP.
One or more form control elements are put inside <form> and </form> tags. The form
element is characterized by different attributes such as name, action, and method.
<form [attributes]>
Form controls
</form>
g.
Error & exception Handling in
PHP :
With PHP 5 came a new object oriented way of dealing with errors.
Exception handling is used to change the normal flow of the code execution if a
specified error (exceptional) condition occurs. This condition is called an exception.
Handling in PHP :
g .Error and Exception handling in PHP: