simplebooklet thumbnail

THis is all new.

of 0
Language and Software:
PHP started out as a small open source project that evolved as more and
more people found out how useful it was. Rasmus Lerdorf unleashed the first
version of PHP way back in 1994.
PHP is a recursive acronym for "PHP: Hypertext Preprocessor".
PHP is a server side scripting language that is embedded in HTML. It is used
to manage dynamic content, databases, session tracking, even build entire e-
commerce sites.
It is integrated with a number of popular databases, including MySQL,
PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
MySQL is the most popular Open Source Relational SQL database
management system. MySQL is one of the best RDBMS being used for developing
web-based software applications.
A database is a separate application that stores a collection of data. Each
database has one or more distinct APIs for creating, accessing, managing,
searching and replicating the data it holds.
Program 1
Base64 Encode and Decode String in PHP
/* encode function */
function base64url_encode($plainText)
$base64 = base64_encode($plainText);
$base64url = strtr($base64, '+/=', '-_,');
return $base64url;
/* decode function */
function base64url_decode($plainText)
$base64url = strtr($plainText, '-_,', '+/=');
$base64 = base64_decode($base64url);
return $base64;
$new1=base64url_encode("hello Paras");
echo $new1,"<br>";
echo $new2;
Program 2
Database Connection in PHP
$username = "root";
$password = "";
$hostname = "localhost";
//connection to the database
$dbhandle = mysqli_connect($hostname, $username, $password) or die("Unable to
connect to MySQL");
echo "Connected to MySQL<br>";
// Database Selected //
$dbselect=mysqli_select_db($dbhandle,$dbname) or die("Database is not found");
echo "Database $dbname is selected.";
SDLC (Software Development Life Cycle) is a process used by
software industry to design, develop and test high quality software’s.
The SDLC aims to produce a high-quality software that meets or
exceeds customer expectations, reaches completion within times
and cost estimates.
It is also called as Software development process.
The software development life cycle (SDLC) is a framework defining
tasks performed at each step in the software development process.
ISO/IEC 12207 is an international standard for software life-cycle
processes. It aims to be the standard that defines all the tasks
required for developing and maintaining software.
2.1.1 Definition-What is SDLC?
SDLC is a process followed for a software project, within a software organization.
It consists of a detailed plan describing how to develop, maintain, replace and
alter or enhance specific software. The life cycle defines a methodology for
improving the quality of software and the overall development process.
2.1.2 Stages of SDLC A typical Software Development life cycle consists of the following stages: -
1. Planning and Requirement Analysis
2. Defining Requirements
3. Designing the product architecture
4. Building or Developing the Product
5. Testing the Product
6. Deployment in the Market and Maintenance The following figure is a graphical representation of the various stages of a typical SDLC-
2.1.3 SDLC Models
There are various software development life cycle models defined and designed
which are followed during software development process. These models are also
referred as "Software Development Process Models". Each process model follows
a Series of steps unique to its type, in order to ensure success in process of
software development.
Following are the most important and popular SDLC models followed in the
industry: -
Waterfall Model
Agile Model
2.2 Waterfall Model
The Waterfall Model was first Process Model to be introduced. It is also referred to
as a linear-sequential life cycle model. It is very simple to understand and use. In a
waterfall model, each phase must be completed before the next phase can begin
and there is no overlapping in the phases.
2.2.1 Waterfall Model Design
Waterfall approach was first SDLC Model to be used widely in Software
Engineering to ensure success of the project. In "The Waterfall" approach, the
whole process of software development is divided into separate phases. In
Waterfall model, typically, the outcome of one phase acts as the input for the next
phase sequentially.
Following is a diagrammatic representation of different phases of waterfall model:
The sequential phases in Waterfall model are: -
Requirement Gathering and analysis: All possible requirements of the system to
be developed are captured in this phase and documented in a requirement
specification doc.
System Design: The requirement specifications from first phase are studied in this
phase and system design is prepared. System Design helps in specifying hardware
and system requirements and also helps in defining overall system architecture.
Implementation: With inputs from system design, the system is first developed in
small programs called units, which are integrated in the next phase. Each unit is
developed and tested for its functionality which is referred to as Unit Testing.
Integration and Testing: All the units developed in the implementation phase are
integrated into a system after testing of each unit. Post integration the entire system
is tested for any faults and failures.
Deployment of system: Once the functional and nonfunctional testing is done, the
product is deployed in the customer environment or released into the market.
Maintenance: There are some issues which come up in the client environment. To
fix those issues patches are released. Also, to enhance the product some better
versions are released. Maintenance is done to deliver these changes in the customer
All these phases are cascaded to each other in which progress is seen as flowing
steadily downwards (like a waterfall) through the phases. The next phase is started
only after the defined set of goals are achieved for previous phase and it is signed
off, so the name "Waterfall Model". In this model phases do not overlap.
2.2.2 Waterfall Model Application
Every software developed is different and requires a suitable SDLC approach to be
followed based on the internal and external factors. Some situations where the use
of Waterfall model is most appropriate are:
Requirements are very well documented, clear and fixed.
Product definition is stable.
Technology is understood and is not dynamic.
There are no ambiguous requirements.
Ample resources with required expertise are available to support the product.
The project is short.
2.2.3 Waterfall Model Advantages & Disadvantages
A. Advantage
The advantage of waterfall development is that it allows for departmentalization
and control. A schedule can be set with deadlines for each stage of development
and a product can proceed through the development process model phases one by
Development moves from concept, through design, implementation, testing,
installation, troubleshooting, and ends up at operation and maintenance. Each
phase of development proceeds in strict order.
B. Disadvantage
The disadvantage of waterfall development is that it does not allow for much
reflection or revision. Once an application is in the testing stage, it is very difficult
to go back and change something that was not well-documented or thought upon in
the concept stage.
2.3 Agile Model
Agile SDLC model is a combination of iterative and incremental process models
with focus on process adaptability and customer satisfaction by rapid delivery of
working software product.
Agile Methods break the product into small incremental builds. These builds are
provided in iterations. Each iteration typically lasts from about one to three weeks.
Every iteration involves cross functional teams working simultaneously on various
areas like planning, requirements analysis, design, coding, unit testing, and
acceptance testing.
2.3.1 Definition- What is Agile?
Agile model believes that every project needs to be handled differently and the
existing methods need to be tailored to best suit the project requirements. In agile
the tasks are divided to time boxes (small time frames) to deliver specific features
for a release. Iterative approach is taken and working software build is delivered
after each iteration. Each build is incremental in terms of features; the final build
holds all the features required by the customer.
Here is a graphical illustration of the Agile Model:
Following are the Agile Manifesto principles: -
Individuals and interactions - in agile development, self-organization and
motivation are important, as are interactions like co-location and pair
Working software - Demo working software is considered the best means of
communication with the customer to understand their requirement, instead of just
depending on documentation.
Customer collaboration - As the requirements cannot be gathered completely in
the beginning of the project due to various factors, continuous customer interaction
is very important to get proper product requirements.
Responding to change - agile development is focused on quick responses to
change and continuous development.
2.3.2 Agile Advantages & Disadvantages
A. Advantages
Is a very realistic approach to software development
Promotes teamwork and cross training.
Functionality can be developed rapidly and demonstrated.
Resource requirements are minimum.
Suitable for fixed or changing requirements
Delivers early partial working solutions.
Good model for environments that change steadily.
Minimal rules, documentation easily employed.
Enables concurrent development and delivery within an overall planned context.
Little or no planning required
Easy to manage
Gives flexibility to developers
B. Disadvantages
Not suitable for handling complex dependencies.
More risk of sustainability, maintainability and extensibility.
An overall plan, an agile leader and agile PM practice is a must without which it
will not work.
Strict delivery management dictates the scope, functionality to be delivered, and
adjustments to meet the deadlines.
Depends heavily on customer interaction, so if customer is not clear, team can be
driven in the wrong direction.
There is very high individual dependency, since there is minimum documentation
Transfer of technology to new team members may be quite challenging due to lack
of documentation.
2.4 Normalization
Database Normalization is a technique of organizing the data in the
database. Normalization is a systematic approach of decomposing
tables to eliminate data redundancy and undesirable characteristics
like Insertion, Update and Deletion Anomalies. It is a multi-step
process that puts data into tabular form by removing duplicated
data from the relation tables.
Normalization is used for mainly two purpose,
Eliminating redundant(useless) data.
Ensuring data dependencies make sense i.e. data is logically stored.
2.4.1 Problem Without Normalization
Without Normalization, it becomes difficult to handle and update the
database, without facing data loss. Insertion, Updating and Deletion
Anomalies are very frequent if Database is not Normalized. To
understand these anomalies let us take an example
of Student table.
Updating Anomaly: To update address of a student who occurs twice or more
than twice in a table, we will have to update Address column in all the rows, else
data will become inconsistent.
Insertion Anomaly: Suppose for a new admission, we have a Student id(id), name
and address of a student but if student has not opted for any subjects yet then we
have to insert NULL there, leading to Insertion Anomaly.
Deletion Anomaly: If (id) 401 has only one subject and temporarily he drops it,
when we delete that row, entire student record will be deleted along with it.
2.4.2 Normalization Rule
Normalization rule are divided into following normal form.
First Normal Form
Second Normal Form
Third Normal Form First Normal Form (1NF)
As per First Normal Form, no two Rows of data must contain
repeating group of information i.e. each set of column must have a
unique value, such that multiple columns cannot be used to fetch
the same row. Each table should be organized into rows, and each
row should have a primary key that distinguishes it as unique.
The Primary key is usually a single column, but sometimes more than
one column can be combined to create a single primary key. For
example, consider a table which is not in First normal form
Student Table:
In First Normal Form, any row must not have a column in which more
than one value is saved, like separated with commas. Rather than
that, we must separate such data into multiple rows.
Student Table following 1NF will be:
Using the First Normal Form, data redundancy increases, as there will
be many columns with same data in multiple rows but each row as a
whole will be unique. Second Normal Form (2NF)
As per the Second Normal Form there must not be any partial dependency of any
column on primary key. It means that for a table that has concatenated primary
key, each column in the table that is not part of the primary key must depend upon
the entire concatenated key for its existence. If any column depends only on one
part of the concatenated key, then the table fails Second normal form.
In example of First Normal Form there are two rows for Adam, to include multiple
subjects that he has opted for. While this is searchable, and follows First normal
form, it is an inefficient use of space. Also in the above Table in First Normal
Form, while the candidate key is {Student, Subject}, Age of Student only depends
on Student column, which is incorrect as per Second Normal Form. To achieve
second normal form, it would be helpful to split out the subjects into an
independent table, and match them up using the student names as foreign keys.
New Student Table following 2NF will be:
In Student Table the candidate key will be Student column, because
all other column i.e. Age is dependent on it.
New Subject Table introduced for 2NF will be:
In Subject Table the candidate key will be {Student, Subject} column.
Now, both the above tables qualify for Second Normal Form and will
never suffer from Update Anomalies. Although there are a few
complex cases in which table in Second Normal Form suffers Update
Anomalies, and to handle those scenarios Third Normal Form is there.
17 Third Normal Form (3NF)
Third Normal form applies that every non-prime attribute of table
must be dependent on primary key, or we can say that, there should
not be the case that a non-prime attribute is determined by another
non-prime attribute. So this transitive functional dependency should
be removed from the table and also the table must be in Second
Normal form. For example, consider a table with following fields.
Student_Detail Table:
In this table Student_id is Primary key, but street, city and state
depends upon Zip. The dependency between zip and other fields is
called transitive dependency. Hence to apply 3NF, we need to
move the street, city and state to new table, with Zip as primary key.
New Student_Detail Table:
Address Table:
The advantage of removing transitive dependency is: -
Amount of data duplication is reduced.
Data integrity achieved.