You are on page 1of 5

DE LUNA, Nico Paulo P.

June 18, 2015

BSIT721 ADDPROG2

Sir EVC

Assignment:

What is PHP?
o

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open


source general-purpose scripting language that is especially suited for web
development.

PHP is a programming language that can do all sorts of things: evaluate form data
sent from a browser, build custom web content to serve the browser, talk to a
database, and even send and receive cookies.

PHP is a server scripting language, and a powerful tool for making dynamic and
interactive Web pages.

PHP is a widely-used, free, and efficient alternative to competitors such as


Microsofts ASP.

PHP variables
o

A variable can have a short name (like x and y) or a more descriptive name (age,
carname, total_volume).

Rules for PHP variables:


A variable starts with the $ sign, followed by the name of the variable
A variable name must start with a letter or the underscore character
A variable name cannot start with a number
A variable name can only contain alpha-numeric characters and underscores (Az, 0-9, and _)
Variable names are case-sensitive ($age and $AGE are two different variables)

Remember that PHP variable names are case-sensitive.

PHP Functions
o

The real power of PHP comes from its functions; it has more than 1000 built-in
functions.

PHP User Defined Functions


Besides the built-in PHP functions, we can create our own functions.

A function is a block of statements that can be used repeatedly in a program.


A function will not execute immediately when a page loads.
A function will be executed by a call to the function.

Create a User Defined Function in PHP


A user defined function declaration starts with the word function:
Syntax:
function functionName(){
code to be executed;
}
Note: A function name can start with a letter or underscore (not a number).
Tip: Give the function a name that reflects what the function does.
Function names are NOT case-sensitive.

PHP Function Arguments


Information can be passed to functions through arguments. An argument is just
like a variable.

Arguments are specified after the function name, inside the parentheses. You can
add as many arguments as you want, just separate them with a comma.

The following example has a function with one argument ($fname). When the
familyName() function is called, we also pass along a name (e.g. Jani), and the
name is used inside the function, which outputs several different first names, but
an equal last name:
Example
<?php
function familyName($fname) {
echo "$fname Refsnes.<br>";
}
familyName("Jani");
familyName("Hege");
familyName("Stale");
?>

PHP Default Argument Value

The following example shows how to use a default parameter. If we call the
function setHeight() without arguments it takes the default value as argument:
Example
<?php
function setHeight($minheight = 50) {
echo "The height is : $minheight <br>";
}
setHeight(350);
setHeight(); // will use the default value of 50
setHeight(135);
setHeight(80);
?>

PHP Functions Returning values

To let a function return a value, use the return statement:


Example
<?php
function sum($x, $y) {
$z = $x + $y;
return $z;
}
echo "5 + 10 = " . sum(5, 10) . "<br>";
echo "7 + 13 = " . sum(7, 13) . "<br>";
echo "2 + 4 = " . sum(2, 4);
?>

Top 10 PHP Frameworks

o Yii

Yii is a component-based high-performance PHP framework for


developing large-scale Web applications. Yii is written in strict OOP
and comes with thorough class reference and comprehensive
tutorials.

o Code Igniter

CodeIgniter is an Application Development Framework - a toolkit for people who build web sites using PHP. Its goal is to enable you to
develop projects much faster than you could if you were writing
code from scratch, by providing a rich set of libraries for commonly
needed tasks, as well as a simple interface and logical structure to
access these libraries. CodeIgniter lets you creatively focus on your
project by minimizing the amount of code needed for a given task.

o CakePHP

CakePHP is a rapid development framework for PHP which uses


commonly known design patterns like ActiveRecord, Association
Data Mapping, Front Controller and MVC. Our primary goal is to
provide a structured framework that enables PHP users at all levels
to rapidly develop robust web applications, without any loss to
flexibility.

o PHPDevShell

PHPDevShell is an Open Source (GNU/LGPL) Rapid Application


Development framework written using only PHP with no Javascript
and comes with a complete GUI admin interface. It is aimed at
developing admin based applications as plugins, where speed,
security, stability and flexibility are essentials. It is designed to have
a very easy learning curve without complicated new terms to learn.
The need for a light, fully functional GUI with limitless configuration
brought forward PHPDevShell. We strive to keep direction and focus
in our development according to our moto.

o Akelos

The Akelos PHP Framework is a web application development


platform based on the MVC (Model View Controller) design pattern.

o Symfony

Symfony is a web application framework for PHP5 projects.

It aims to speed up the creation and maintenance of web


applications, and to replace the repetitive coding tasks by power,
control and pleasure.

o Prado

The PRADO group is a team of PRADO enthusiasts who develop and


promote the PRADO framework and the related projects.

o Zend

Extending the art & spirit of PHP, Zend Framework is based on


simplicity, object-oriented best practices, corporate friendly
licensing, and a rigorously tested agile codebase.

o ZooP

The Zoop Object

Oriented

Php

Framework

(The

Zoop

PHP

Framework for short). A framework written in and for php.

The Zoop PHP Framework is stable, scalable and portable. It has


been in production use for the last 5 years and has been used in
many production environments. The Zoop PHP Framework is
designed to be fast, efficient and clean. It is easily extendable and
you choose to include only the functionality you use.

o QPHP

QPHP stands for Quick PHP and is a MVC framework similar as


architecture to ASP.NET.
I, as the author of the project, have spent the last 8 years working
on web projects using various Java frameworks, ASP.NET and PHP.
This framework tries to get the best of the above platforms as well
as to avoid the problematic parts.

You might also like