Download here - The Smartpath Information Systems

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Microsoft SQL Server wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database model wikipedia , lookup

Clusterpoint wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Transcript
Basics and uses of php
Prepared By
www.thesmartpath.in
Powerpoint Templates
Page 1
Index
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
What is PHP
Features of PHP
What PHP can do
What is PHP file
Versions of PHP – PHP 5
Versions of PHP – PHP 6 and Unicode
Versions of PHP – PHP 7
Installing PHP
PHP Syntax
PHP variables
PHP Comments
PHP Variables
Powerpoint Templates
Page 2
Index
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
Rules for declaring variables
PHP Variables Scope
PHP – Data Types
Uses of PHP - e commerce
Uses of PHP - Project Management
Uses of PHP Desktop Application
Uses of PHP - Web Templates
Uses of PHP – Parsing XML Files
PHP and MYSQL
PHP and MYSQL (About MYSQL)
Powerpoint Templates
Page 3
What is php
 PHP is an acronym for "PHP: Hypertext Preprocessor“
 PHP is a widely-used, open source scripting language
 PHP scripts are executed on the server
 PHP is free to download and use
Powerpoint Templates
Page 4
Features of php
1. PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
2. PHP is compatible with almost all servers used today (Apache, IIS, etc.)
3. PHP supports a wide range of databases
4. PHP is free. Download it from the official PHP resource: www.php.net
5. PHP is easy to learn and runs efficiently on the server side
Powerpoint Templates
Page 5
What php can do
1. PHP can generate dynamic page content
2. PHP can create, open, read, write, delete, and close files on the server
3. PHP can collect form data
4. PHP can send and receive cookies
5. PHP can add, delete, modify data in your database
6. PHP can be used to control user-access
7. PHP can encrypt data
Powerpoint Templates
Page 6
What is php file
1. PHP files can contain text, HTML, CSS, JavaScript,
and PHP code
2. PHP code are executed on the server, and the result
is returned to the browser as plain HTML
3. PHP files have extension ".php”
Powerpoint Templates
Page 7
Versions of php – php 5
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 (PDO) 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. Late static
binding had been missing from PHP and was added in version 5.3.
Many high-profile open-source projects ceased to support PHP 4 in
new code as of February 5, 2008, because of the GoPHP5 initiative
provided by a consortium of PHP developers promoting the
transition from PHP 4 to PHP 5.
Powerpoint Templates
Page 8
Versions of php – php6
PHP 6 and UNICODE
PHP received mixed reviews due to lacking native Unicode support at
the core language level. In 2005, a project headed by Andrei Zmievski
was initiated to bring native Unicode support throughout PHP, by
embedding the International Components for Unicode (ICU) library,
and representing text strings as UTF-16 internally. Since this would
cause major changes both to the internals of the language and to user
code, it was planned to release this as version 6.0 of the language, along
with other major features then in development.
Powerpoint Templates
Page 9
Versions of php – php 7
Php 7
PHP 7 gets its foundations from an experimental PHP branch that was
originally named phpng (PHP next generation), which aims at optimizing
PHP performance by refactoring the Zend Engine while retaining nearcomplete language compatibility. As of 14 July 2014, WordPress-based
benchmarks, which serve as the main benchmark suite for the phpng
project, show an almost 100% increase in performance. Changes from
phpng are also expected to make it easier to improve performance in the
future, as more compact data structures and other changes are seen as
better suited for a successful migration to a just-in-time (JIT) compiler.
Because of the significant changes, this reworked Zend Engine will be
called Zend Engine 3, succeeding the Zend Engine 2 used in PHP 5.
Powerpoint Templates
Page 10
Installing php
Set up php on your own pc
 However, if your server does not support PHP, you must:
 install a web server
 install PHP
install a database, such as MySQL
Use web host with php support
If your server has activated support for php –
a) create some .php files and place them in web directory server will
b) automatically parse them for you
Because PHP is FREE most web hosts offer php support
Powerpoint Templates
Page 11
Php - Syntax
Basic php Syntax
Php script can bé placed anywhere in document
A php script starts with <?php and ends with ?>
<?php
// php code Goes hère
?>
The default file extension of PHP is « .php »
A php file contains normally HTML tags and PHP script code
In PHP keywords such as(if- else echo, while etc) are NOT case
sensitive
Powerpoint Templates
Page 12
Php - Comments
Comments in PHP
A comment in PHP code is a line that is not read/executed as part of the
program. Its only purpose is to be read by someone who is looking at the
code.
Comments can be used to:
 Let others understand what you are doing
 Remind yourself of what you did - Most programmers have
experienced coming back to their own work a year or two later and
having to re-figure out what they did. Comments can remind you of what
you were thinking when you wrote the code
Powerpoint Templates
Page 13
Php - variables
Php 5 variables
Creating (Declaring) PHP Variables :
In PHP, a variable starts with the $ sign, followed by the name of the variable
Using PHP Variables

A variable can have a short name (like x and y) or

A more descriptive name (age, carname, total_volume).
Powerpoint Templates
Page 14
Rules for PHP declaring 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 (A-z, 0-9, and _ )
 Variable names are case-sensitive ($age and $AGE are two different
variables)
Powerpoint Templates
Page 15
Php-variables Scope
Php 5 variables scope
In PHP, variables can be declared anywhere in the script. The
scope of a variable is the part of the script where the variable
can be referenced/used.
PHP has three different variable scopes:



local
global
static
Powerpoint Templates
Page 16
Php – Data Types
Php 5 Data Types
PHP supports following data types :







String
Integer
Float
Boolean
Array
Object
Resource
Powerpoint Templates
Page 17
Uses of php - e-commerce
1. E-commerce
E-commerce is one of the major uses for PHP. From a small
business level to an enterprise level, businesses are always looking to
create additional streams of revenue online. If you know how to
integrate existing e-commerce solutions or build your own from
scratch, this gives you a distinct advantage with your clients.
Powerpoint Templates
Page 18
Uses of php – Project mangement
2. Project Management Tools
For both freelancers and web development firms alike,
project management is an important aspect of your
business. Your clients need a resource to be able to check
the progress of the work and provide feedback. Ideally, with
a good project management system in place, your clients will
be thoroughly pleased with the end result.
Powerpoint Templates
Page 19
Uses of php- Desktop applications
3. GUI Interface
For those of you who are up to the challenge, you can extend your PHP
installation to create desktop applications. This one is a challenge because it
requires some extensive knowledge of PHP and it might also be easier to create
desktop applications in other programming languages. If PHP is your favorite
programming language, then you can use some of these PHP extensions to get
you started creating GUI applications.

PHP GTK - This extension is a popular open source that GIMP toolkit
 ZZEE PHP GUI - A paid solution that allows you to turn your PHP scripts
into windows applications.
Powerpoint Templates
Page 20
Uses of php-web templates
4. Creating dynamic website templates
Using PHP, you can make it easier to add pages and elements to your
websites dynamically. You begin by creating the HTML page and splitting it
into the header, main content, and footer sections. Add the .php extension to
your subsequent pages and use server-side Includes for the header and
footer for each new page. You can also have dynamic sidebars and top
navigation sections. As a matter of fact, the more "templated" your site is,
the easier it is to update the content.
Powerpoint Templates
Page 21
Uses of php - Parsing XML files
5. Parsing XML Files
PHP allows you to parse XML files. Parsing XML is an important feature
of PHP 5 because not all browsers can output the contents of an XML
file; so you can create a parser in PHP to facilitate this process. Using
XML is important for RSS feeds, and also for data storage and rendering
data on different devices - for example, cell phones use an
implementation of XML called WML (Wireless Markup Language).
Working with XML files in PHP is similar to handling the opening, closing,
and reading of a file. The steps involved are creating an XML parser,
setting functions to handle your opening and closing XML tags, opening
the file for reading, reading the file incrementally and then closing it.
Powerpoint Templates
Page 22
Uses of php-parsing XML files
Powerpoint Templates
Page 23
Php and MYSQL
Php MySQL database
With PHP, you can connect to and manipulate databases.
MySQL is the most popular database system used with PHP.
The data in a MySQL database are stored in tables. A table is a collection of
related data, and it consists of columns and rows.
Databases are useful for storing information categorically.
Facts about MySQL database
MySQL is the de-facto standard database system for web sites with
HUGE volumes of both data and end-users (like Facebook, Twitter,
and Wikipedia).
Another great thing about MySQL is that it can be scaled down to
support embedded database applications.
Powerpoint Templates
Page 24
Php and MYSQL
About MySQL
 MySQL is a database system used on the web
 MySQL is a database system that runs on a server
 MySQL is ideal for both small and large applications
 MySQL is very fast, reliable, and easy to use
 MySQL uses standard SQL
 MySQL compiles on a number of platforms
 MySQL is free to download and use
 MySQL is developed, distributed, and supported by Oracle Corporation
Powerpoint Templates
Page 25
Powerpoint Templates
Page 26