php basics


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

php basics

  1. 1. "PHP Hypertext Preprocessor" <br />BY<br />NIRMAL FELIX. K<br />……………………………………………………………………<br />
  2. 2. Introduction to PHP<br /><ul><li>PHP standing for Personal Home Page/Form Interpreter
  3. 3. HTML embedded scripting language used to create dynamic Web pages.
  4. 4. IN 1994, the language was designed
  5. 5. The goal of the language is to allow Web developers to write dynamically generated pages quickly.</li></li></ul><li>PHP Functions<br />
  6. 6. Working with PHP<br />To work PHP in our system we must download the following packages.<br />The first step is to download the packages:<br /> <br />• Apache :<br />• PHP :<br />• MySQL<br />
  7. 7. Introduction to LAMP and WAMP<br /><ul><li>These packages are called as LAMP (Linux, Apache, My SQL, PHP) for Linux operating system.
  8. 8. WAMP (Windows, Apache, My SQL, PHP ) for windows operating system.
  9. 9. Then install and configure these packages</li></li></ul><li>Getting Started with PHP<br />If you choose PHP as your development language, what you need <br />to get started depends on:<br /> <br />• Sound knowledge of HTML. <br /> <br />• Working knowledge of JavaScript(optional) <br /> <br />• Sound Knowledge of SQL<br /> <br />• Access to a web server that have Apache, My SQL and PHP<br /> configured and installed on your machine.<br />
  10. 10. To check weather WAMP OR XAMPP is working enter <br />http://localhost/xampp/ in your Web browser. <br />The page will displayed as given below:<br />
  11. 11. PHP Basics<br /> <br />PHP Syntax:<br /><? php écho 'Hello PHP'; ?><br /><ul><li>The nomenclature <? Php?> That makes the web server passes this portion of code to your PHP module
  12. 12. Note also the built-in PHP "echo" that enables printing to the screen
  13. 13. PHP can also be "mixed" in the HTML, which is convenient but not recommended </li></li></ul><li>PHP Operators<br />The most common PHP operators are<br /><ul><li> assignment operators
  14. 14. arithmetic operators
  15. 15. combined operators
  16. 16. comparison operators
  17. 17. logical operators. </li></li></ul><li>PHP Variables <br />A variable in PHP is always preceded by the dollar sign: $So to declare a variable we can write: <br />$ myVar = 'value';Note that the semicolon at the end is required at the end <br />of each statement <br />
  18. 18. PHP String <br /> <br />A string variable is used to store and manipulate<br />a piece of text.<br />To declare a string we can write:<br /><?php<br /> $text_str= “Hello World!”;<br /> echo “$text_str” ;<br /> ?><br />
  19. 19. PHP Arrays <br />By providing the values as arguments to the array() function: <br /> <br /><?php<br /> $citylist = array("Noida", "Delhi", "Raipur", "Ambikapur", "Bhagalpur");<br />?><br />
  20. 20. PHP Flow control and looping<br /> <br /><ul><li>If-else
  21. 21. Switch-case
  22. 22. For loop
  23. 23. While loop
  24. 24. Do-while loop
  25. 25. Foreach loop</li></li></ul><li>Working with File System & I/O<br /> <br />Working with Files <br />Opening a file :<br />Syntax to open a file:<br /> <br />$my_file=fopen(“file name”, “mode constant”);<br /> <br />Closing a file :<br />syntax to close a file:<br /> <br />fclose(file_pointer);<br />
  26. 26. Working with Database <br />Creating a Connection using mysql:<br /> <br /> <br />In PHP, mysql_connect() function is used to connect to database .<br />Syntax of mysql_connect:<br /> <br />$con=mysql_connect(“localhost/ip”, “user_name”, “password”);  <br />
  27. 27. Various PHP functions :<br /><ul><li> Error Handling
  28. 28. Creating tables
  29. 29. Handling File Upload
  30. 30. Retrieving Database and Table list
  31. 31. Used in email sessions </li></li></ul><li>Conclusion:<br /><ul><li> Simplicity. For people new to programming, this is frequently</li></ul> the strongest appeal.<br /><ul><li>Even those with little or no programming experience can </li></ul> quickly get up to speed and begin creating full-fledged <br /> applications.<br /><ul><li>Because it was specifically designed for creating </li></ul> web applications.<br /><ul><li>PHP has a host of built-in functions to handle common needs .</li></li></ul><li>THANK “U” <br />