SlideShare a Scribd company logo
Features of PHP PHP stands for Hypertext Preprocessor“.  It is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.  It is an interpreted language. There are three main fields where PHP scripts are used.  Server side scripting Command line scripting.  Writing client-side GUI applications.For this PHP-GTK is used.  PHP-GTK is an extension for the PHP programming language that implements language bindings for GTK+. It provides an object-oriented interface to GTK+ classes and functions and greatly simplifies writing client-side cross-platform GUI applications.
PHP can be used on all major operating systems, including Linux, many Unix variants, Microsoft Windows, Mac OS X  etc.  PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server  and many others.
You also have the choice of using procedural programming or object oriented programming, or a mixture of them.  PHP does more than just generating dynamic web-pages.  PHP's abilities includes: Generating images dynamically PDF files  Flash movies Compression Download and upload XML support
PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others.  You can also open raw network sockets and interact using any other protocol.  PHP has support for the WDDX complex data exchange between virtually all Web programming languages. (Support for web services) PHP has support for instantiation of Java objects and using them transparently as PHP objects. You can also use CORBA extension to access remote objects.  e.g. You can use java classes in php.
A sample PHP script <html> <head> <title>PHP Test</title> </head> <body> <?php  echo &quot;<p>Hello World</p>&quot;;  echo phpinfo(); ?> </body> </html>  A call to the  phpinfo()  function returns a lot of useful information about your system and setup such as available predefined variables, loaded PHP modules, and configuration settings.
php syntaxes are similar to C. php is whitespace insensitive. e.g. $four =  2 + 2; php is sometimes case insensitive.  i.e. All variables are case sensitive.
Basics of variable Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive. PHP is also context-sensitive like perl.  A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
PHP provides 8 primitive data-types. Four scalar types: boolean integer float string Two compound types array object Two special types: resource NULL PHP,types are associated with values rather than variables. No previous declaration is needed. You can assign value to variable as and when you need it. e.g.  $int_var=15; $str=“string1”;
If you want to check out the type and value of a certain variable, use  var_dump() .  It dumps information about variable. <?php $b = 3.1; $c = true; var_dump($b, $c); ?>  o/p :  float(3.1)  bool(true)  If you want to get type of a variable, then use gettype(). echo gettype($bool); // prints out &quot;boolean“ echo gettype($str);  // prints out &quot;string“
To check type of veriables in condition, separate functions are there for each type.  basic syntax is is_type(variable) some of it are is_integer  is_float  is_numeric  is_string is_scalar is_object is_array  It returns true if variable will be of that specific type. Otherwise it returns false. If you would like to force a variable to be converted to a certain type, you may either cast the variable or use the  settype()  function on it.  It returns true on success and false on failure. settype($var, &quot;integer&quot;);
In php, default error reporting setting allows you to use unassigned variables without errors. To change this setting you should set error reporting level to E_ALL in your php.ini file. error_reporting(E_ALL); To check if variable is assigned a value or not, use isset($var) . PHP variables are global in scope. You can use it throughout your program.
To define boolean variable, $flag=True; To define string variable, $str=“string variable”; String can be enclosed in double quotes, single quotes or you can also use heredoc operator. $str = <<<EOF Example of string spanning multiple lines using heredoc syntax. EOF; To define constant, define(&quot;MAXSIZE&quot;, 100);
Operators Arithmetic : +,-,/,%,* String . , .=  Assignment operators for all above operators. +=, -= etc , ++ , -- Comparision == , != , <> , > , >= , < , <= , === === returns true if its two operands are having the same value, and they are of the same type.  e.g.  $a=15; $b=15; if( $a === $b) { print “Identical variables”; }
PHP supports one execution operator: backquotes (``).  PHP will attempt to execute the contents of the backquotes as a system command; the output will be returned in a variable. <?php $output = `ls`; echo &quot;<pre>$output</pre>&quot;; ?>
Control Structures if,else,elseif while,for , do..while , for , foreach , break , continue , switch  $i=1; switch ($i) {     case 0:         print &quot;i equals 0&quot;;         break;     case 1:         print &quot;i equals 1&quot;;         break;     case 2:         print &quot;i equals 2&quot;;         break;     default :         print &quot;i equals -1&quot;; } comments .  # , // , /*  */

More Related Content

PPTX
Lesson 2 php data types
PPTX
Lesson 4 constant
PPTX
Data types in php
PPTX
Lesson 6 php if...else...elseif statements
PPTX
PHP Basics
PPTX
Php intro by sami kz
PDF
Php tutorial
Lesson 2 php data types
Lesson 4 constant
Data types in php
Lesson 6 php if...else...elseif statements
PHP Basics
Php intro by sami kz
Php tutorial

What's hot (20)

PPTX
Lesson 3 php numbers
PPTX
PHP Powerpoint -- Teach PHP with this
PPTX
C language updated
PPTX
php basics
ODP
PHP Web Programming
PDF
Ruby quick ref
PDF
Ruby cheat sheet
DOCX
Free PHP Book Online | PHP Development in India
PPTX
PHP Basics
PPT
Download It
PDF
C Programming Project
PPTX
Basic of PHP
PDF
Introduction to Go language
PDF
PHP Reviewer
PPT
Introduction to php php++
PPTX
Lesson 1 php syntax
PDF
Python: an introduction for PHP webdevelopers
PPT
course slides -- powerpoint
Lesson 3 php numbers
PHP Powerpoint -- Teach PHP with this
C language updated
php basics
PHP Web Programming
Ruby quick ref
Ruby cheat sheet
Free PHP Book Online | PHP Development in India
PHP Basics
Download It
C Programming Project
Basic of PHP
Introduction to Go language
PHP Reviewer
Introduction to php php++
Lesson 1 php syntax
Python: an introduction for PHP webdevelopers
course slides -- powerpoint
Ad

Viewers also liked (20)

PDF
Butler zero
PPT
Unbreakable: Father
PPT
Trees I Know
PDF
Copies de seguretat de dades amb cobianbackup
PPT
Teresa Ann Hughes, Dissertation Defense, Dr. William Kritsonis, Dissertation ...
DOC
Dr. S. Marie McCarther, University of Missouri - Kansas City
PPT
Heaven and Hell
ODP
Canvi tauler de control
DOC
Photographing Torture at Abu Ghraib: Gendered Violence and The Other
DOC
Chapter15[1]
PDF
National FORUM of Multicultural Issues Journal, Dr. William Allan Kritsonis, ...
PPT
West Africa food crisis
DOC
Ch 15 Legalities Affecting Schooling - Dr. William Allan Kritsonis
PPT
Bijoli's vegetable garden
PDF
Samsung: Universe Campaign Concepts (Strategy)
PDF
Dr. Fred C. Lunenburg, Escalation of Commitment - Published in the INTERNAT...
PDF
Russia pres. butler & kritsonis
KEY
Preso orangevalley klantcongres
PPT
Student Rights & Bill Or Rights
PPTX
Fit Vortrag Micheuz
Butler zero
Unbreakable: Father
Trees I Know
Copies de seguretat de dades amb cobianbackup
Teresa Ann Hughes, Dissertation Defense, Dr. William Kritsonis, Dissertation ...
Dr. S. Marie McCarther, University of Missouri - Kansas City
Heaven and Hell
Canvi tauler de control
Photographing Torture at Abu Ghraib: Gendered Violence and The Other
Chapter15[1]
National FORUM of Multicultural Issues Journal, Dr. William Allan Kritsonis, ...
West Africa food crisis
Ch 15 Legalities Affecting Schooling - Dr. William Allan Kritsonis
Bijoli's vegetable garden
Samsung: Universe Campaign Concepts (Strategy)
Dr. Fred C. Lunenburg, Escalation of Commitment - Published in the INTERNAT...
Russia pres. butler & kritsonis
Preso orangevalley klantcongres
Student Rights & Bill Or Rights
Fit Vortrag Micheuz
Ad

Similar to Php1 (20)

PPT
Open Source Package Php Mysql 1228203701094763 9
PPT
Open Source Package PHP & MySQL
PPT
PPT
What Is Php
 
PPT
Internet Technology and its Applications
PPT
Introduction To Php For Wit2009
PPTX
FYBSC IT Web Programming Unit IV PHP and MySQL
PPTX
Learn PHP Basics
PPT
Introduction to PHP
PPT
P H P Part I, By Kian
ODP
Php Learning show
PDF
Programming in PHP Course Material BCA 6th Semester
PPT
PPTX
The basics of php for engeneering students
PPTX
Introduction to php
PDF
Introduction to PHP - Basics of PHP
PDF
WT_PHP_PART1.pdf
PPT
02 Php Vars Op Control Etc
PPT
Php intro
Open Source Package Php Mysql 1228203701094763 9
Open Source Package PHP & MySQL
What Is Php
 
Internet Technology and its Applications
Introduction To Php For Wit2009
FYBSC IT Web Programming Unit IV PHP and MySQL
Learn PHP Basics
Introduction to PHP
P H P Part I, By Kian
Php Learning show
Programming in PHP Course Material BCA 6th Semester
The basics of php for engeneering students
Introduction to php
Introduction to PHP - Basics of PHP
WT_PHP_PART1.pdf
02 Php Vars Op Control Etc
Php intro

More from Keennary Pungyera (6)

DOC
Sap procurement process flow
TXT
DOC
Interest Calculation
PPT
The Simple Life Very Beautiful 19082008
PPT
Fuction call
Sap procurement process flow
Interest Calculation
The Simple Life Very Beautiful 19082008
Fuction call

Recently uploaded (20)

PDF
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
PDF
UTS Health Student Promotional Representative_Position Description.pdf
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PPTX
Presentation on Janskhiya sthirata kosh.
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
How to Manage Global Discount in Odoo 18 POS
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
English Language Teaching from Post-.pdf
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PDF
Landforms and landscapes data surprise preview
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PDF
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf
5.Universal-Franchise-and-Indias-Electoral-System.pdfppt/pdf/8th class social...
UTS Health Student Promotional Representative_Position Description.pdf
Revamp in MTO Odoo 18 Inventory - Odoo Slides
Open Quiz Monsoon Mind Game Prelims.pptx
Presentation on Janskhiya sthirata kosh.
How to Manage Starshipit in Odoo 18 - Odoo Slides
Week 4 Term 3 Study Techniques revisited.pptx
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
Renaissance Architecture: A Journey from Faith to Humanism
How to Manage Global Discount in Odoo 18 POS
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
English Language Teaching from Post-.pdf
UPPER GASTRO INTESTINAL DISORDER.docx
Landforms and landscapes data surprise preview
Open Quiz Monsoon Mind Game Final Set.pptx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
How to Manage Loyalty Points in Odoo 18 Sales
Piense y hagase Rico - Napoleon Hill Ccesa007.pdf

Php1

  • 1. Features of PHP PHP stands for Hypertext Preprocessor“. It is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. It is an interpreted language. There are three main fields where PHP scripts are used. Server side scripting Command line scripting. Writing client-side GUI applications.For this PHP-GTK is used. PHP-GTK is an extension for the PHP programming language that implements language bindings for GTK+. It provides an object-oriented interface to GTK+ classes and functions and greatly simplifies writing client-side cross-platform GUI applications.
  • 2. PHP can be used on all major operating systems, including Linux, many Unix variants, Microsoft Windows, Mac OS X etc. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server and many others.
  • 3. You also have the choice of using procedural programming or object oriented programming, or a mixture of them. PHP does more than just generating dynamic web-pages. PHP's abilities includes: Generating images dynamically PDF files Flash movies Compression Download and upload XML support
  • 4. PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol. PHP has support for the WDDX complex data exchange between virtually all Web programming languages. (Support for web services) PHP has support for instantiation of Java objects and using them transparently as PHP objects. You can also use CORBA extension to access remote objects. e.g. You can use java classes in php.
  • 5. A sample PHP script <html> <head> <title>PHP Test</title> </head> <body> <?php echo &quot;<p>Hello World</p>&quot;; echo phpinfo(); ?> </body> </html> A call to the phpinfo() function returns a lot of useful information about your system and setup such as available predefined variables, loaded PHP modules, and configuration settings.
  • 6. php syntaxes are similar to C. php is whitespace insensitive. e.g. $four = 2 + 2; php is sometimes case insensitive. i.e. All variables are case sensitive.
  • 7. Basics of variable Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive. PHP is also context-sensitive like perl. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.
  • 8. PHP provides 8 primitive data-types. Four scalar types: boolean integer float string Two compound types array object Two special types: resource NULL PHP,types are associated with values rather than variables. No previous declaration is needed. You can assign value to variable as and when you need it. e.g. $int_var=15; $str=“string1”;
  • 9. If you want to check out the type and value of a certain variable, use var_dump() . It dumps information about variable. <?php $b = 3.1; $c = true; var_dump($b, $c); ?> o/p : float(3.1) bool(true) If you want to get type of a variable, then use gettype(). echo gettype($bool); // prints out &quot;boolean“ echo gettype($str);  // prints out &quot;string“
  • 10. To check type of veriables in condition, separate functions are there for each type. basic syntax is is_type(variable) some of it are is_integer is_float is_numeric is_string is_scalar is_object is_array It returns true if variable will be of that specific type. Otherwise it returns false. If you would like to force a variable to be converted to a certain type, you may either cast the variable or use the settype() function on it. It returns true on success and false on failure. settype($var, &quot;integer&quot;);
  • 11. In php, default error reporting setting allows you to use unassigned variables without errors. To change this setting you should set error reporting level to E_ALL in your php.ini file. error_reporting(E_ALL); To check if variable is assigned a value or not, use isset($var) . PHP variables are global in scope. You can use it throughout your program.
  • 12. To define boolean variable, $flag=True; To define string variable, $str=“string variable”; String can be enclosed in double quotes, single quotes or you can also use heredoc operator. $str = <<<EOF Example of string spanning multiple lines using heredoc syntax. EOF; To define constant, define(&quot;MAXSIZE&quot;, 100);
  • 13. Operators Arithmetic : +,-,/,%,* String . , .= Assignment operators for all above operators. +=, -= etc , ++ , -- Comparision == , != , <> , > , >= , < , <= , === === returns true if its two operands are having the same value, and they are of the same type. e.g. $a=15; $b=15; if( $a === $b) { print “Identical variables”; }
  • 14. PHP supports one execution operator: backquotes (``). PHP will attempt to execute the contents of the backquotes as a system command; the output will be returned in a variable. <?php $output = `ls`; echo &quot;<pre>$output</pre>&quot;; ?>
  • 15. Control Structures if,else,elseif while,for , do..while , for , foreach , break , continue , switch $i=1; switch ($i) {     case 0:         print &quot;i equals 0&quot;;         break;     case 1:         print &quot;i equals 1&quot;;         break;     case 2:         print &quot;i equals 2&quot;;         break;    default :         print &quot;i equals -1&quot;; } comments . # , // , /* */