7/31/2019 WebQuest PHP
1/16
Programming Language
WebQuestPH P PHP: Hypertext Preprocessor
Submitted to:
Eddie Bouy Palad,
IT Department, SCS, MSU-IIT
Submitted by:
Zachary Albia
Elrey Lorea
Michelle Cepada,
BS IT 3
7/31/2019 WebQuest PHP
2/16
2 Programming Language WebQuest
HISTORY
PHP originally stood for Personal Home Page. It began in 1994 as a set ofCommon Gateway Interface
binaries written in the C programming language by the Danish/Greenlandic programmer Rasmus Lerdorf.
He initially created these Personal Home Page Tools to replace a small set of Perl scripts he had been
using to maintain his personal homepage. He combined these binaries with his Form Interpreter to create
PHP/FI (Personal Home Page / Forms Interpreter), which had more functionality. PHP/FI included a
larger implementation for the C programming language and could communicate with databases, enabling
the building of simple, dynamic web applications. He released PHP publicly on June 8, 1995 to accelerate
bug location and improve the code. This release was named PHP version 2 and already had the basic
functionality that PHP has today. This included Perl-like variables, form handling, and the ability to embed
HTML. The syntax was similar to Perl but was more limited, simpler, and less consistent.
PHP 3.0 was the first version that closely resembles PHP as we know it today. It was created by
Andi Gutmans and Zeev Suraski in 1997 as a complete rewrite, after they found PHP/FI 2.0 severely
underpowered for developing an eCommerce application they were working on for a University project.
In an effort to cooperate and start building upon PHP/FI's existing user-base, Andi, Rasmus and Zeev
decided to cooperate and announce PHP 3.0 as the official successor of PHP/FI 2.0, and development of
PHP/FI 2.0 was mostly halted. They rewrote the parser in 1997 and formed the base of PHP 3, changing
the language's name to the recursive initialism PHP: Hypertext Preprocessor.
By the winter of 1998, shortly after PHP 3.0 was officially released, Andi Gutmans and Zeev
Suraski had begun working on a rewrite of PHP's core. The design goals were to improve performance of
complex applications, and improve the modularity of PHP's code base. Such applications were made
possible by PHP 3.0's new features and support for a wide variety of third party databases and APIs, but
PHP 3.0 was not designed to handle such complex applications efficiently. The new engine, dubbed 'Zend
Engine' (comprised of their first names, Zeev and Andi), met these design goals successfully, and was first
introduced in mid 1999. PHP 4.0, based on this engine, and coupled with a wide range of additional new
7/31/2019 WebQuest PHP
3/16
3 Programming Language WebQuest
features, was officially released in May 2000, almost two years after its predecessor, PHP 3.0. In addition
to the highly improved performance of this version, PHP 4.0 included other key features such as support
for many more Web servers, HTTP sessions, output buffering, more secure ways of handling user input
and several new languages constructs.
Late static binding has been missing from PHP and will be added in version 5.3.On July 13, 2004,
PHP 5 was released, powered by the new Zend Engine II. PHP 5 included new features such as improved
support for object-oriented programming, the PHP Data Objects extension (which defines a lightweight
and consistent interface for accessing databases), and numerous performance enhancements. In 2008,
PHP 5 became the only stable version under development.
7/31/2019 WebQuest PHP
4/16
4 Programming Language WebQuest
GENEALOGY
7/31/2019 WebQuest PHP
5/16
5 Programming Language WebQuest
TECHNICAL DETAILS
PHP is a general-purpose scripting language that is especially suited for web development. PHP
generally runs on a web server, taking PHP code as its input and creating web pages as output. It can also
be used for command-line scripting and client-side GUI applications. PHP can be deployed on most web
servers, many operating systems and platforms, and can be used with many relational database
management systems. It is available free of charge, and the PHP Group provides the complete source code
for users to build, customize and extend for their own use.
PHP primarily acts as a filter, taking input from a file or stream containing text and/or PHP
instructions and outputs another stream of data; most commonly the output will be HTML. (PHP 4) the
PHP parser compiles input to produce bytecode for processing by the Zend Engine, giving improved
performance over its interpreter predecessor.
Originally designed to create dynamic web pages, PHP's principal focus is server-side scripting,
and it is similar to other server-side scripting languages that provide dynamic content from a web server
to a client. PHP has also attracted the development of many frameworks that provide building blocks and
a design structure to promote rapid application development (RAD).
PHP as a language is imperative and object-oriented (as of PHP 4.0). PHPs typing discipline is
dynamic and weak, i.e., a variables type can easily be changed throughout runtime and a variable can be
used without first being declared. As shown in the genealogy, the language design of PHP is influenced by
C-based and Perl-based languages.
PHP is dynamically typed. That is, the rules are not as strict with variablesthey do not have to be
declared and they can hold any type of object. Variables are case sensitive and their names are preceded
by a dollar sign ($). The variable name is case-sensitive. Variables names cannot start with a number.
Arrays are heterogeneous, meaning a single array can contain objects of more than one type. Variables are
evaluated inside double quotation marks ("), but not inside single quotation marks ('). Functions and
7/31/2019 WebQuest PHP
6/16
6 Programming Language WebQuest
other expressions are not evaluated inside double quotes but can be added to strings using periods for
concatenation. A period (.) concatenates strings together. Boolean variables have two possible values
True and False, another form of boolean would be replacing true and false with 1 and 0 (respectively)
but is not a standard of coding. Integers are number variables. They are whole numbers that can be
positive, negative, octal, and hexadecimal.
PHP 5 introduces private and protected member variables; they allow you to define the visibility
of class properties. Private and protected methods are also introduced. PHP 5 also introduces abstract
classes and abstract methods. An abstract method only declares the method's signature and does not
provide an implementation. A class that contains abstract methods needs to be declared an abstract class.
(Interfaces) A class may implement an arbitrary list of interfaces. (Object Cloning) If the developer asks to
create a copy of an object by using the reserved word clone, the Zend engine will check if a __clone()
method has been defined or not. (Unified Constructors) PHP 5 introduces a standard way of declaring
constructor methods by calling them by the name __construct(). (Destructors) PHP 5 introduces a
destructor concept similar to that of other object-oriented languages, when the last reference to an object
is destroyed, the object's destructor (a class method named __destruct() that receives no parameters) is
called before the object is freed from memory. PHP 4 had no exception handling. PHP 5 introduces an
exception model similar to that of other programming languages.
PHP treats new lines as whitespace, in the manner of a free-form language (except when inside
string quotes). Statements are terminated only by a semicolon (;) except in a few special cases. //
comment(for single line comment), and /* multi-line comment */(for multiple line comments).
PHP includes a large number of free and open-source libraries with the core build. PHP is a
fundamentally Internet-aware system with modules built in for accessing FTP servers, many database
servers, embedded SQL libraries like embedded MySQL and SQLite, LDAP servers, and others. Many
functions familiar to C programmers such as the printf family are available in the standard PHP build.
7/31/2019 WebQuest PHP
7/16
7 Programming Language WebQuest
EVALUATION
Readability
Characteristics Rating (1-5) Comments
Simplicity/ Orthogonality Although PHP has a very large feature set of functionsand keywords, it takes a considerable amount of
effort to read and understand PHP code for the same
reason. Also, a lot of PHPs built-in functions are said
to be redundant. This is said to make it difficult to
program in the language without the frequent
consultation of a reference work.
Control Structures PHPs vast feature set includes support for many
control structures. Some of the more uncommon ones
are include(), include_once(), require(),
require_once, and goto all of which allow the
code to execute away from the file/line where the
control statement is used: which could reduce
readability. Also, with include() and require(),
dependencies are created which could lead to difficult
code maintenance. On the other hand, these features
allow a PHP file to be built from several files, which
allow programmers to distribute functionality.
Data type and Structures The weak, dynamic typing of PHP implies that a
variable can change type during runtime. This alsoimplies that data structures in PHP can be
heterogeneous and its contents, dynamically typed at
the same time. Programmers might have to trace
these changes as well and could lead to confusing
code, especially when debugging.
Syntax Design PHP uses the $ sign to name variables which makes it
easier to identify them but because PHP syntax is
influenced by C/Java, its use of braces for pairing
control structures makes it difficult to know which
group is being ended. The language allows keywords
to be used as identifiers, but this could lead to
confusion. Another argument against previous and
current stable versions of PHP is the lack of lexical
scoping and namespaces (available from alpha release
5.3.0 onwards). This implies that for the most part, all
variables are of a global scope and makes for very
awkward, unreadable function names.
7/31/2019 WebQuest PHP
8/16
8 Programming Language WebQuest
Writability
Characteristics Rating (1-5) Comments
Simplicity/ Orthogonality With the same consideration to that of PHPs
readability, PHP is infamous for having an unwieldy
number of functions and keywords. On the other
hand, this allows programmers to do things like
connecting to a database with minimal amount of
code.
Support for abstraction Before PHP 3.0, the language had very little support
for abstraction. PHP 3.0 saw the introduction of
object-oriented features, 4.0 introduced refinements
to those features, and 5.0 introduced private and
protected member variables and methods, along with
abstract classes and abstract methods. It alsointroduced a standard way of declaring constructor
and destructors similar to that of other object-
oriented languages, such as C++. In conclusion, while
previous versions of PHP generally lacked features
which support abstraction, these features are slowly
being integrated into the language with every new
release. PHP 5.3.0 in particular promises to include
namespaces to further abstraction support.
Expressivity PHP is an expression-oriented language, in the sense
that almost everything is an expression. For example'$a = 5'. There are two values involved here, the
value of the integer constant '5', and the value of$a
which is being updated to 5. But there's one
additional value involved, the value of the assignment
itself. The assignment itself evaluates to the assigned
value. It means that'$a = 5', is an expression with
the value 5. Thus, writing something like '$b = ($a
= 5)' is like writing '$a = 5; $b = 5; Since
assignments are parsed in a right to left order, you
can also write '$b = $a = 5'.
Generally speaking, there are many ways to do things
in PHP. Printing out a statement can be done with a
wide variety of statements like echo(), print(),
etc. PHP is a very flexible language to code in,
although at the cost of being at times unstable.
7/31/2019 WebQuest PHP
9/16
9 Programming Language WebQuest
Reliability
Characteristics Rating (1-5) Comments
Readability PHP is touted by some as a language which is quite
hard to read. With the huge array of built-in functions,
the redundancy of some of those functions, the lack ofnamespaces for PHPs built-in functions, cryptic error
messages, and the difficulty of telling the differences
between the ways those functions work, wading
through PHP code can be quite a challenge.
Writability While PHP may be hard to read, it is easy to write.
PHP is a powerful, expressive language and with each
new release, more features such as support for object-
oriented programming will provide the language with
the expressive power similar to OO languages such as
Java and C++. A major plus often pointed out about
PHP is its ability to allow beginners to get things done.
Type Checking The type of a variable is not usually set by the
programmer; rather, it is decided at runtime by PHP
depending on the context in which that variable is
used. Programmers will often have a hard time trying
to evaluate a particular variable type within complex
variable type computations.
Exception Handling An exception can be thrown, and caught within PHP.
PHP has a strong structure for exception handling like
other object-oriented programming language.
Restricted Aliasing PHP has no restrictions on the use of aliasing. This can
often lead to unintended side effects that are difficult
to detect especially when debugging.
7/31/2019 WebQuest PHP
10/16
10 Programming Language WebQuest
SAMPLE PROGRAMS
Hello World:
Arithmetic with PHP:
7/31/2019 WebQuest PHP
11/16
11 Programming Language WebQuest
SCREENSHOTS
Running the Hello World Program:
Program Output:
7/31/2019 WebQuest PHP
12/16
12 Programming Language WebQuest
INSTALLATION
For this section, we will be introducing the BitNami WAPPStack (Windows, Apache, PostgreSQL,
PHP) as a distributed binary executable installer for PHP, Apache, and PostgreSQL, all running on
Windows XP and can be downloaded from:http://www.bitnami.org/stacks/. WAPPStack is an easy to
install software platform that greatly simplifies the deployment of Open Source web stacks on Windows. It
includes ready-to-run versions of Apache, PostgreSQL, PHP, phpPgAdmin and required dependencies and
installs in minutes. By default the graphical installation mode will be described by the following:
1. You will be greeted by the 'Welcome' screen. Pressing 'Next' will take you to the 'LicenseAgreement' page.
http://www.bitnami.org/stacks/http://www.bitnami.org/stacks/http://www.bitnami.org/stacks/http://www.bitnami.org/stacks/7/31/2019 WebQuest PHP
13/16
13 Programming Language WebQuest
2. You must accept the agreement to continue the installation. The next step is to select theinstallation directory. The default installation path will be a folder on your home directory if
you are running the installer as a regular user, or /opt/wappstack-1.1-1, if you are running
the installation as root. If the destination directory does not exist, it will be created as part
of the installation.
7/31/2019 WebQuest PHP
14/16
14 Programming Language WebQuest
3. After selecting the installation directory you will be asked for the password to the initialPostgreSQL root and postgres accounts. This password cannot be empty.
4. The default listening port for Apache is 8080 and for PostgreSQL is 5432. If those ports arealready in use by other applications, you will be prompted for alternate ports to use.
Remember that if you plan to run both applications as a regular user you should select port
numbers above 1024.
7/31/2019 WebQuest PHP
15/16
15 Programming Language WebQuest
5. Finally, the installer will ask you for the initial password to access your phpPgAdmininstallation through the web. This password cannot be empty.
6. You are now ready to begin the installation, which will start when you press 'Next'.
7. Once the installation process has been completed, you will see the 'Installation Finished'page.
7/31/2019 WebQuest PHP
16/16
16 Programming Language WebQuest
BIBLIOGRAPHY
BitNami WAPP Stack 1.1-1. INSTALLATION. 28 Jan 2009. BitNami. 4 Feb. 2009.
PHP Documentation. 18 Feb 2009. PHP Group.18 Feb. 2009.
w3schools.com. Basic PHP Syntax. 1999-2009. W3Schools. 18 Feb. 2009.
"PHP." Wikipedia. 18 Feb. 2009. Wikimedia Foundation. 18 Feb. 2009.
< http://en.wikipedia.org/wiki/PHP >
Genealogical tree of programming languages. Illustration. Wikimedia Foundation. Maximilian Drrbecker. 18 Feb.
2009.
PHP Criticism. Global Oneness. 18 Feb. 2009.
PHP in contrast to Perl. 18 Feb. 2009.
Top Related