Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 2. PHP <ul><li>PHP Stands for &quot; Hypertext Preprocessor .&quot;
  2. 3. PHP is an HTML-embedded Web scripting language.
  3. 4. PHP is an free, open-source server-side scripting language. </li></ul>
  4. 5. <ul><li>PHP is a server-side scripting language for creating dynamic Web pages.
  5. 6. This is the most traditional and main target field for PHP.
  6. 7. To know more about php defintion visit </li></ul>
  7. 8. How PHP Works: When a user navigates in her browser to a page that ends with a .php extension, the request is sent to a web server, which directs the request to the PHP interpreter.
  8. 9. Basic PHP Syntax : PHP Tags <ul><li>PHP code must be contained in special tags so that the PHP interpreter can identify it. </li></ul>Depending on the PHP configuration, these tags can take several forms: <?php PHP CODE GOES IN HERE ?> <ul><li>It is known as the XML style, because it can be used inside of an XML document. </li></ul>
  9. 10. HTML OR SCRIPT TAG: <script language=&quot;php&quot;> PHP CODE GOES IN HERE </script> ASP-style tags: <% PHP CODE GOES HERE %>
  10. 11. 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;. Syntax // This is a single-line comment /* This is a multi-line comment.*/
  11. 12. Variables: PHP variables begin with a dollar sign ($) as shown below. Syntax: $var_name = &quot;Value&quot;; Each php statement must ends with semicolon.
  12. 13. PHP Functions: There are literally hundreds of built-in PHP functions. A function might take zero arguments or several arguments (e.g, mail(), which takes three required and two optional arguments). The syntax for calling a function is straightforward: function_name(arguments);
  13. 14. Sample code:PhpBasics/Demos/PhpInfo.php <html> <head> <title>PHPINFO</title> </head> <body> <?php //Output information on the PHP environment phpinfo(); ?> </body> </html>
  14. 15. The php.ini file <ul><li>The php.ini is the main PHP configuration file . php.ini file controls many aspect of php's behavior.
  15. 16. To read PHP, it must be named 'php.ini' .
  16. 17. It allows the user to define some of the settings for the PHP interprter . </li></ul>
  17. 18. SYNTAX: <ul><li>The syntax of the file is extremely simple.
  18. 19. Whitespace and Lines beginning with a semicolon are silently ignored. </li></ul>Directives : directive = value Directive names are* case sensitive * - foo=bar is different from FOO=bar.
  19. 20. Expressions in the INI file are limited to bitwise operators : <ul><li>|- bitwise OR
  20. 21. & -bitwise AND
  21. 22. ~ -bitwise NOT
  22. 23. !-boolean NOT </li></ul>Boolean flags can be turned on using the values 1, On, True or Yes. They can be turned off using the values 0, Off, False or No.
  23. 24. OBJECT ORIENTED FEATURES: PHP scripting language provides object oriented features through the class keyword. We can use the following coding conventions to distinguish between private, public and protected variables: <ul><li>All private variables and functions always start with underscore &quot;_&quot; followed by lowercase letters like var $_myvar; </li></ul>
  24. 25. <ul><li>All Protected variables and functions always start with &quot;_T&quot; followed by lowercase letters like var $_Tmyvar
  25. 26. All Public variables and functions do not start with underscore &quot;_&quot; like var $myvar;
  26. 27. All variables and functions always start with lowercase letter (no uppercase) like var $_myvar; and NOT like var $_Myvar; </li></ul>
  27. 28. File Uploads: <ul><li>To allow HTTP file uploads.
  28. 29. file_uploads = On
  29. 30. Temporary directory for HTTP uploaded files (will use system default if not specified).
  30. 31.
  31. 32. upload_tmp_dir =Maximum allowed size for uploaded files.
  32. 33. upload_max_filesize = 2M
  33. 34. visit </li></ul> for more syntax
  34. 35. Limitations of PHP : <ul><li>PHP is NOT 100 % pure Object Oriented scripting language. But in near future PHP may support 100% object oriented scripting.
  35. 36. PHP will NOT give the performance of &quot;C&quot; or &quot;C++&quot; language. Because it is scripting language and is interpreted it will be a bit slower than the optimized &quot;C++&quot; programs. </li></ul>
  36. 37. Advantages: <ul><li>We can very rapidly develop web applications in PHP as compile and link is eliminated in PHP scripting language.
  37. 38. PHP applications are very stable and do not depend on the browser technologies unlike Javascript applications which depend on browsers.
  38. 39. PHP will give you the freedom to select any server platform. </li></ul>
  39. 40. <ul><li>PHP has excellent database conectivity to all SQL database servers.
  40. 41. PHP has C++, PERL, Javascript like syntax features and has programs like 'ptags/ctags' to navigate the source code
  41. 42. PHP runs on all UNIX'es, linux, Windows 95/NT/2000 and is more powerful than ASP, JSP and others.
  42. 43. PHP has a very large user base and developer base. </li></ul>