1 / 29

I213-Dynamic Web Solutions

I213-Dynamic Web Solutions. Introduction to PHP. Objectives. What is PHP? PHP history Versions PHP IDE’s Basic Syntax. What is PHP?.

varen
Download Presentation

I213-Dynamic Web Solutions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. I213-Dynamic Web Solutions Introduction to PHP

  2. Objectives • What is PHP? • PHP history • Versions • PHP IDE’s • Basic Syntax

  3. What is PHP? • PHP is a computer scripting language originally designed for producing dynamic web pages. It is primarily used for server-side scripting, but can be used from a command line interface or in standalone graphical applications. • http://www.php.net/manual/en/index.php

  4. PHP History • PHP was originally created by RasmusLerdorf in 1995 and was written in the C programming language. • PHP originally stood for Personal Home Page. • It was used to perform tasks such as displaying his résumé and recording how much traffic his page was receiving and could connect to a database.

  5. PHP History • He released PHP publicly in 1996 to speed up the finding of bugs and improving the code. • This release was named PHP version 2 and already had the basic functionality that PHP has today. • This included Perl-like variables, form handling, and the ability to embed HTML. The syntax was similar to Perl but was more limited, simpler.

  6. PHP History • Zeev Suraski and Andi Gutmans, two Israeli’s rewrote the parser in 1997 and formed the base of PHP 3, changing the language's name to PHP: Hypertext Preprocessor. • The official launch came in June 1998. • They also founded Zend Technologies which manages the development of PHP.

  7. Choosing a PHP IDE http://coding.smashingmagazine.com/2009/02/11/the-big-php-ides-test-why-use-oneand-which-to-choose/

  8. Save php documents with a .php extension

  9. Script Tags • <?php    ?> • If short tags are enabled in PHP.ini:<?         ?> • But short tags may not be enabled in all servers

  10. phpinfo()

  11. phpinfo()

  12. PHP code can be intermingled between HTML content

  13. You can also use PHP to output HTML content

  14. Using PHP to output HTML <tags> PHP functions

  15. echo vs. print • Print always returns a value • Echo performs slightly faster http://www.learnphponline.com/php-basics/php-echo-vs-print

  16. End of statement • The semicolon(;) is compulsory • echo “Hello World”;

  17. Comments // PHP comment /*This is a multi-line Comment */ # PHP comment

  18. PHP Variables • PHP variables are prefixed by the “$”character. • $some_php_variable For a variable name to be valid, it must: • start with a letter or underscore • followed by any number of letters, numbers, or underscores

  19. PHP Data Types • http://www.phpknowhow.com/basics/data-types/

  20. Case-Sensitivity • Yes for variables, • No for function-names and reserved words

  21. Case-Sensitivity

  22. PHP Constants • Constants hold values that don’t get changed during the runtime of a script. • Same naming rules apply for constants except that $ sign is not used when defining constants. • To give an emphasis to constants, it’s a common practice to define constant names in UPPER-CASE

  23. Constant Example Once defined, a new value cannot be assigned to a constant.

  24. Case-Sensitivity • Yes for variables, • No for function-names and reserved words

  25. Strings Delimited by single-quotes, double-quotes:

  26. Single Quotes vs. Double Quotes

  27. Escaping Special Characters

  28. Concatenating PHP Strings

More Related