SlideShare uma empresa Scribd logo
1 de 21
PHP Definition:   PHP stands for Personal Home Page. The PHP Hypertext Preprocessor allows web developers to create dynamic content that interacts with databases. PHP applications are normally found on Linux servers and in conjunction with MySQL databases. It provides those servers with functionality similar to that provided to the Windows platform by Active Server Pages technology.
PHP statements must be inside of PHP tags to be processed by the PHP interpreter. Each PHP statement must end with a semi-colon, which tells the PHP interpreter that the statement is complete. If a semi-colon does not appear at the end of a line, the interpreter will assume that the statement continues onto the next line.
The PHP interpreter condenses all sequential whitespace in PHP scripts to a single whitespace. This convenient feature allows PHP developers to structure their code in a readable format without being concerned about the effects of line breaks and tabs.
COMMENTS PHP has two forms of comments: * Single-line comments begin with a double slash (//). * Multi-line comments begin with "/*" and end with "*/".
SYNTAX // This is a single-line comment /* This is a multi-line comment. */
PHP FUNCTION There are literally hundreds of built-in PHP functions that do everything from returning the current date and time on the server to pulling data out of a database. A function might take zero arguments (e.g, phpinfo(), which returns information on the PHP environment) or it might take several arguments
SYNTAX The syntax for calling a function is straightforward: Syntax: function_name(arguments);
SAMPLE CODE PhpBasics/Demos/PhpInfo.php <html> <head> <title>PHPINFO</title> </head> <body> <?php //Output information on the PHP environment phpinfo(); ?> </body> </html>
PHP OPERATOR Mathematical Operators Operator Name.  Example: Addition + $a + $b Subtraction - $a - $b
Multiplication * $a * $b Division  / $a / $b Modulus % $a % $b
String Operators Operator Name  Example . Concatenation  $a . $b 'Hello' . ' world!'
Assignment Operators Operator Name Example  = Assignment  $a = 1; $c = 'Hello' . ' world!'; += -= *= /= %= .=
Combination Assignment   $a += 1; $a -= 1; $a *= 2; $a /= 2; $a %= 2; $a .= ' world!';
Increment By One ++ $a++; ++$a; Decrement By One -- $a--; --$a;
Other Operators Operator Name Example Ternary   ?: $foo = ($age >= 18) ? 'adult' : 'child'; Error Suppression   @ Creating Dynamic Pages $a = @(1/0);
SAMPLE CODE: <html> <head> <title>Hello World!</title> </head> <body> <?php //Write out Hello World! echo 'Hello World!'; ?> </body> </html> PHP.NET
BASIC PHP SYNTAX PHP Tags: PHP code must be contained in special tags so that the PHP interpreter can identify it. Depending on the PHP configuration, these tags can take several forms: < ?php PHP CODE GOES IN HERE ?>
This is the most commonly used (and recommended) form. It is known as the XML style, because it can be used inside of an XML document without causing the document to become poorly formed. <script language=&quot;php&quot;> PHP CODE GOES IN HERE </script>
Less is more.  The shortest and easiest way to deal with the xml tag problem assuming short tags is enabled and you don't care to listen to people who want you to always use the full php tag is this: <<??>?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?>
you also can use this kind of syntax: <?php if( condition ): ?>    <?php else: ?>    <?php endif; ?>
<? PHP CODE GOES HERE ?> &quot;Short&quot; tags. <% PHP CODE GOES HERE %>  HTML STYLE TAG

Mais conteúdo relacionado

Mais procurados (18)

IT Club @ NCP - PHP Workshop May 10, 2011
IT Club @ NCP - PHP Workshop May 10, 2011IT Club @ NCP - PHP Workshop May 10, 2011
IT Club @ NCP - PHP Workshop May 10, 2011
 
Php
PhpPhp
Php
 
Phpwebdevelping
PhpwebdevelpingPhpwebdevelping
Phpwebdevelping
 
PHP slides
PHP slidesPHP slides
PHP slides
 
PHP
PHPPHP
PHP
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Php
PhpPhp
Php
 
Babitha5.php
Babitha5.phpBabitha5.php
Babitha5.php
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
Basic php
Basic phpBasic php
Basic php
 
php basics
php basicsphp basics
php basics
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
PHP Loops and PHP Forms
PHP  Loops and PHP FormsPHP  Loops and PHP Forms
PHP Loops and PHP Forms
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Sending emails through PHP
Sending emails through PHPSending emails through PHP
Sending emails through PHP
 
PHP Basic & Variables
PHP Basic & VariablesPHP Basic & Variables
PHP Basic & Variables
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php hypertext pre-processor
Php   hypertext pre-processorPhp   hypertext pre-processor
Php hypertext pre-processor
 

Semelhante a PHP Definition (38 (20)

Php1
Php1Php1
Php1
 
Php1
Php1Php1
Php1
 
Php1
Php1Php1
Php1
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Php intro
Php introPhp intro
Php intro
 
Php
PhpPhp
Php
 
PHP.docx
PHP.docxPHP.docx
PHP.docx
 
Php1
Php1Php1
Php1
 
Php1(2)
Php1(2)Php1(2)
Php1(2)
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Article 01 What Is Php
Article 01   What Is PhpArticle 01   What Is Php
Article 01 What Is Php
 
Php Ppt
Php PptPhp Ppt
Php Ppt
 
Phpwebdev
PhpwebdevPhpwebdev
Phpwebdev
 

PHP Definition (38

  • 1. PHP Definition: PHP stands for Personal Home Page. The PHP Hypertext Preprocessor allows web developers to create dynamic content that interacts with databases. PHP applications are normally found on Linux servers and in conjunction with MySQL databases. It provides those servers with functionality similar to that provided to the Windows platform by Active Server Pages technology.
  • 2. PHP statements must be inside of PHP tags to be processed by the PHP interpreter. Each PHP statement must end with a semi-colon, which tells the PHP interpreter that the statement is complete. If a semi-colon does not appear at the end of a line, the interpreter will assume that the statement continues onto the next line.
  • 3. The PHP interpreter condenses all sequential whitespace in PHP scripts to a single whitespace. This convenient feature allows PHP developers to structure their code in a readable format without being concerned about the effects of line breaks and tabs.
  • 4. COMMENTS PHP has two forms of comments: * Single-line comments begin with a double slash (//). * Multi-line comments begin with &quot;/*&quot; and end with &quot;*/&quot;.
  • 5. SYNTAX // This is a single-line comment /* This is a multi-line comment. */
  • 6. PHP FUNCTION There are literally hundreds of built-in PHP functions that do everything from returning the current date and time on the server to pulling data out of a database. A function might take zero arguments (e.g, phpinfo(), which returns information on the PHP environment) or it might take several arguments
  • 7. SYNTAX The syntax for calling a function is straightforward: Syntax: function_name(arguments);
  • 8. SAMPLE CODE PhpBasics/Demos/PhpInfo.php <html> <head> <title>PHPINFO</title> </head> <body> <?php //Output information on the PHP environment phpinfo(); ?> </body> </html>
  • 9. PHP OPERATOR Mathematical Operators Operator Name. Example: Addition + $a + $b Subtraction - $a - $b
  • 10. Multiplication * $a * $b Division / $a / $b Modulus % $a % $b
  • 11. String Operators Operator Name Example . Concatenation $a . $b 'Hello' . ' world!'
  • 12. Assignment Operators Operator Name Example = Assignment $a = 1; $c = 'Hello' . ' world!'; += -= *= /= %= .=
  • 13. Combination Assignment $a += 1; $a -= 1; $a *= 2; $a /= 2; $a %= 2; $a .= ' world!';
  • 14. Increment By One ++ $a++; ++$a; Decrement By One -- $a--; --$a;
  • 15. Other Operators Operator Name Example Ternary ?: $foo = ($age >= 18) ? 'adult' : 'child'; Error Suppression @ Creating Dynamic Pages $a = @(1/0);
  • 16. SAMPLE CODE: <html> <head> <title>Hello World!</title> </head> <body> <?php //Write out Hello World! echo 'Hello World!'; ?> </body> </html> PHP.NET
  • 17. BASIC PHP SYNTAX PHP Tags: PHP code must be contained in special tags so that the PHP interpreter can identify it. Depending on the PHP configuration, these tags can take several forms: < ?php PHP CODE GOES IN HERE ?>
  • 18. This is the most commonly used (and recommended) form. It is known as the XML style, because it can be used inside of an XML document without causing the document to become poorly formed. <script language=&quot;php&quot;> PHP CODE GOES IN HERE </script>
  • 19. Less is more.  The shortest and easiest way to deal with the xml tag problem assuming short tags is enabled and you don't care to listen to people who want you to always use the full php tag is this: <<??>?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?>
  • 20. you also can use this kind of syntax: <?php if( condition ): ?>   <?php else: ?>   <?php endif; ?>
  • 21. <? PHP CODE GOES HERE ?> &quot;Short&quot; tags. <% PHP CODE GOES HERE %> HTML STYLE TAG