Вы находитесь на странице: 1из 11

PHP

The programming language called PHP is quickly rising to be one of the most
preferred web browser programming languages due to its user-friendliness,
efficiency, and user control. PHP allows a user to describe specific functions
within the code in order to drastically control the way a web browser displays
and organizes information. A user is able to mix PHP and HTML within the
same document to reach the desired effect.

WHY PHP

PHP is easy to learn


And allows for users to make a web page look and behave exactly as
they want it to.
Easy To Read
PHP is preferred among users because it is easy to read and
understand.

Many

programming

languages

are

complex

and

intimidating to new users while PHP is organized, clean, and fluent.


PHP documents do not have to necessarily be in any order which
allows for users to quickly add new functions whenever they want
without having to make sure that the new code is in the correct place.
This is excellent for users who have long scripts for many of their
pages, especially for style sheets and reference documents.
Easy To Edit
PHP is also easy to edit as a user is able to quickly scan a PHP
document for the code that they are looking for and change it to suit
their needs. Many other programming languages require that you

change multiple functions within several documents in order to do the


same thing that PHP can. PHP documents can also be easily integrated
into a collection of other PHP documents or individual PHP commands.
This allows for users to take full advantage of their programming skills
and computer experience as they can write their own PHP scripts and
extensions without having to handle a large amount of file cleaning.
More Control
PHP offers more control over web browsers than other programming
languages do. Many other programming languages require large scripts
to do simple tasks while PHP can do the same thing with a few lines of
code.

PHP allows

users

to design web pages

to their exact

specifications and it can even be used alongside other programming


languages to perform a wider variety of tasks. When using PHP, the
user can stop focusing on programming and concentrate more on
designing their website.
Better Performance
PHP has better performance

ratings

than

other

programming

languages do. PHP is fast, efficient, and works great in almost any web
browser as well as integrating into almost any server. A user is able to
add a few lines of code to a PHP document, click save, and watch their
website transform into a more powerful and more organized version of
itself. PHP documents are high in demand because they compete with
almost all other programming languages available. PHP is also quickly
growing in its capabilities and offers more features as well as better
operating standards every day.
PHP Is Free
Another reason that PHP is preferred among users is that it is entirely
free. While many other programming languages require that the user
obtains expensive programs and pays for support files, PHP is open to
anyone, anywhere, and any time. A beginner in PHP does not have to
worry about finding support for their interest in programming and web

design as there is an entire online community dedicated to assisting


others in PHP manipulation and implementation. PHP is also aided by
many large companies that contribute to its success on a daily basis.
PHP Is Widely Available
As PHP has become such a success on the open market, it is very
difficult to come across a web server that does not support PHP
development. Users can also take satisfaction in that both individual
PHP tags as well as entire PHP documents can be found on the Internet
at no cost. Thousands of these predefined PHP commands are available
around every virtual corner and even those predefined documents can
easily be edited to suit the user's unique needs.

HISTORY
PHP as its known today is actually the successor to a product named PHP/FI created
in 1994 by Ramus Lerdorf, the very first incarnation of PHP was a simple set of
common Gateway Interface (GCI) binaries written in the C programming language.
Originally it is used for tracking visits to his online resume, he named the suite of
scripts PERSONAL HOMEPAGE.
In June 1995, Ramus released the source code for PHP tools to the public, which
allowed developers to use it as they saw fit and it also allowed users to encourage
and to provide fixes for bugs in the code, and to generally improve upon it.
Hypertext Preprocessor:: PHP some time I used to call Personal Home Page PHP is
an open source server side scripting language that mainly used for developing web
applications and web services, but is also used as a general purpose programming
language.
PHP code is usually processed by a PHP interpreter implemented as a module in the
web server or as a common gateway interface (GCI) PHP code may be embedded
into HTML code, or it can be used in combination with various web template
systems, and web framework. PHP code is usually processed by a PHP interpreter
implemented as a module in the web server. Over time, more functionally was

desired and Ramus rewrote PHP tools, producing a much larger and richer
implementation. This new model was capable of database interaction and more,
providing a framework upon which users could develop simple dynamic web
application such as guestbook.

REASONS FOR EXISTANCE


PHP
PHP
PHP
PHP
PHP
PHP
PHP

can
can
can
can
can
can
can

generate dynamic page content


create, open read, write, delete and close files on the server
collect form data
send and received cookies
Add, delete, modify data in your database
restrict user to access some pages on your website
encrypt data.

SEQUENCING

A Sequence describes the behavior of values arranged in a single, linear


dimension. Some languages refer to this as a "List". Its similar to an array
that

uses

incremental

integer

keys,

with

the

exception

of

few

characteristics: Values will always be indexed as [0, 1, 2, , size - 1].Only


allowed to access values by index in the range [0, size - 1].Use cases:
Wherever you would use an array as a list (not concerned with keys).A more
efficient alternative toSplDoublyLinkedList and SplFixedArray.
Working with Sequenced Data Objects
Sequenced data objects are SDOs which can track property ordering across
the properties of a data object. They can also contain unstructured text
elements (text element which do not belong to any of the SDO's properties).
Sequenced data objects are useful for working with XML documents which
allow unstructured text (i.e. mixed=true) or if the elements can be
interleaved (<A/><B/><A/>).

This can occur for example when the schema defines maxOccurs>1 on a
element which is a complex Type with a choice order indicator.
The examples below assume an SDO created with the following schema and
instance information, using the XML Data Access Service.
The schema below describes the format of a letter. The letter can optionally
contain three properties; date, firstName, and lastName. The schema states
mixed="true" which means that unstructured text can be interspersed
between the three properties.
The following is an instance letter document. It contains the three letter
properties; date, firstName and lastName, and has unstructured text
elements for the address and letter body.
.

SELECTION FEATURES

Conditional statements used to perform different actions based on different


conditions

If statement executes some code if one condition is true.


If else statement execute some code if a condition is true and

another code if that condition is false.


If else if statement executes different code for more than two

conditions.
Switch statement select one of many blocks of code to be executed.

EXPRESSION AND ASSIGNMENT OF PHP.

PHP is an expression oriented language, in the since that almost everything


is an expression. PHP is all about using variables within and expressions. A
language needs basic operators called operands to create an expression,
PHP is an imperative language the most common and important operator is
the assignment operator (=).
Types of operators used in PHP

Assignment operator
Arithmetic operator
Comparison operators
Incrementing/decrementing operator
Logical operators
Bitwise operatorsabili
Assignment operator

Much like c/c++, PHP includes combined assignment operators, which aid
writty
Example of an assignment operator (=)
Example
$a = $b
$a += $b
$a .= $b

Result
Set b to be same value as a
Equivalent to $a=$a+$b
Equivalent to $a=$a . $b

Arithmetic operators
PHP has a basic arithmetic operator that are effective on numeric data types
are;
Operand
Operator
+
Addition
_
Subtraction
*
Multiplication
/
Division
%
Modulus
.
Concatenation for strings
String is an extremely important useful operation since PHP mostly deals
with strings

Comparison operators
These operators or expressions return a value of true (or 1) and/or false
(or0).
Operand
==
!=
<>
<
>
<=
>=

Operators
Equal
Not equal
Not equal
Less then
Greater than
Less than or equal to
Greater than or equal to

Incrementing/decrementing
Example
++ $a
$a ++
--$a
$a --

Name
Pre-increment

Effect
Increment by 1 then

Post-increment

return $a value
Return $a value then

Pre- decrement

increment by 1
Decrease $a value by 1

Post-decrement

then return $a
Return $a then
decrease $a value by 1

Logical operators
Example
And
Or
Xor
!
&&
!!

STRENGHT OF PHP

Name
And
Or
Xor

Effect
True if both are true
True if either is true
True if either is true

Not
And
Or

,but not both


True if not true
True if both are true
True if either are true

1. Supports.
Database connectivity PHP can access many different databases including
MySql, Oracle, and MS Access. Supports sessions. Since PHP is so popular and
widely used, finding help or documentation for PHP online is extremely easy.
The best part is the support is free through forums, PDFs, blogs, and social
media. The fact that its open source also contributes to the large support
community of PHP and LAMP (Linux, Apache, MySQL, and PHP) in general.
PHP has the largest user base of any scripting language.

PHP also has support services using protocols such as LDAP, IMAP,
SNMP, NNTP, POP3, HTTP, COM (on Windows)PHP has extremely useful
text processing features, from the POSIX Extended or Perl regular
expressions to parsing XML documents. For parsing and accessing XML
documents, PHP 5 standardizes all the XML extensions on the solid
base of libxml2 and extends the feature set adding SimpleXML and
XMLReader support.Easy deployment and cost effective hosting
2.

3.

4.

5.
6.

7.

8.

Unique session generation. PHP can generate unique session IDs. The ID
follows the user during a single session on a web site. This simplifies creating
shopping cart applications and tracking user's behaviors.
Eliminates client configuration problems. With PHP there is no need to
worry if the client has the appropriate software installed, since the application
is executed on the server.
Reduces development time. Even a newcomer can begin developing PHP
applications in hours. Yet PHP contains many advanced features for
professional programmers.
Maintains source code security. The user does not see your source code
as they do with JavaScript.
Simple and easy to learn PHP scripting is definitely one of the easiest, if
not the easiest scripting language to learn and grasp for developers. This is
partially due to the similarities which
PHP syntax has with C and Java. Even if the only knowledge of development
that you have is with HTML, picking up PHP is still fairly easy. For developers
just starting out, PHP is often the first scripting language they learn because
its clear and easy to understand.
Freedom When comparing PHP to a language such as ASPX, the level of
freedom you get is far superior. PHP is open source. You can use any text
editor in order to code PHP such as Notebook++, jEdit, Emacs, Bluefish, or
even just Notepad if you feel inclined. If you want to develop applications
with ASPX, youre going to be limited to Microsoft Visual Studio. Restrictions
are never a good thing, especially with coding. PHP also isnt OS specific. You
can run PHP on: Linux, Mac OSX, Windows, UNIX other than ASP,
ASP.NET,JSP etc.
Free. There are no costs associated with using PHP including updates.
Keeping costs down is a goal of any business and developers as well. So the

fact that you can code programs with PHP for free is a huge benefit that you
wont get with JPS, ASP, or other scripting languages that require paid
hosting. There are no licenses, restrictions, or royalty fees involved at all. PHP
is 100% free for anyone to use.
9. Integration PHP is used for so many web applications and actually powers
over 30% of the web. Systems such as MongoDB, Memcache, and Pusher all
integrate with PHP. Almost any industry you can think of uses PHP
applications in some fashion including banks,hospitals, government, and
large corporations.
10. Frameworks Almost every benefit of PHP seems to go back to the fact that
the community is so large. The number of PHP frameworks available is even
further proof of how strong the PHP community is. Whether youre looking for
database access libraries, session management, or code reuse, you will have
no problem finding PHP frameworks to give you a helping hand. Some
popular PHP frameworks include: Aiki, Symfony, Zend, Silex, Slim
11. Easier to fix problems When it comes to web application development,
youre bound to run into issues and come across the occasional, fail. But the
benefit you get with PHP is that problems arent as difficult to find and fix as
they are with other languages. This is because with each request, PHP cleans
up and starts over. So an issue with one request will not necessarily disrupt
another.
12. Scalability In the world of IT, the word scalability is like gold. Whether you?
re dealing with databases, hosting, or in this case, programming, scalability is
never a bad thing. Due to the way PHP is built, you can easily increase your
cluster size by adding more servers as your projects row.
13. Object Oriented PHP actually has the ability to call Java and WindowsCOM
objects. In addition to this, you can create custom classes. Other classes can
actually borrow from those custom classes as well which extends the
capabilities of PHP even further.
14. Speed. since PHP does not use a lot of a systems resources in order to run,
it operates much faster than other scripting languages. Hosting PHP is also
very easy and lot of hosts provide support for PHP. Even when used with
other software, PHP still retains speed without slowing down other processes.
Being that PHP is a mature language, it is also fairly stable because all the
kinks have been worked out over the years.
15.Embedded code. With PHP you write HTML script with embedded code
delineated with special start and end tags. The embedded code is executed
on the server and then sent to your browser. What is displayed in the browser
is the result from the code's execution. This is very different from other
scripting languages like Perl and C where code is written to output HTML
commands. While similar to JavaScript, the main difference with PHP is the
code is executed on the servers,whereas with JavaScript the code is executed
on the client-side. With JavaScript it is possible to determine the underlying
code, whereas with PHP the underlying code is hidden from the user.
Important Critique of PHP include:

Client side scripting. Since PHP is a server side language, the programs cannot be
executed on the client. Thus the server might be slowed down while multiple PHP
applications are executed.
Error Handling. Error handling in PHP is still primitive. However you can code your
way around most problems. Since PHP is a server side language, the programs
cannot be executed on the client. Thus the server might be slowed down while
multiple PHP applications are executed.

Security flaws due to unknown vulnerabilities.


PROGRAM TO COMPUTE ALL PRIME NUMDERS BETWEEN 1 AND AN INPUT N

<style>
div{
font-family: Times new roman;
font-size: 25px;
color: red;
}
</style>
<?php

$n1=$_POST['sn'];
$sum = 0;
echo "<div>";
for($i=2;$i<=$n1;$i++)
{
if($i==2 || $i==3 || $i==5 || $i==7){
echo " $i ";

}
// all divisible factors.
elseif(($i%2)!=0 && ($i%3)!=0 && ($i%5)!=0 && ($i%7)!=0)
{
echo " $i";
$sum += $i;
}
else
continue;
}
echo "are prime numbers between 1 and $n1.<br>";
echo "sum:" . $sum;
echo "</div>";
?>

GROUP 2
NANLOP MIMANG PATIENCE - PLASU/2012/NAS/0027.
JOSHUA .P.JOSEPH - PLASU/2012/NAS/0072.
DINFA SAMUEL NASARA - PLASU/2013/FNS/0077.
YILDAM BLESSING NANSIK - PLASU/2012/NAS/0036.
MIKAN NIAPSUK CORNELIUS PLASU/2012/NAS/0028.

Вам также может понравиться