PHP_basic.ppt - PHP Basic Introduction PHP is a server scripting language and is a powerful tool for making dynamic and interactive Web pages quickly

PHP_basic.ppt - PHP Basic Introduction PHP is a server...

This preview shows page 1 - 12 out of 149 pages.

PHP Basic
Introduction PHP is a server scripting language, and is a powerful tool for making dynamic and interactive Web pages quickly. PHP is a efficient alternative to competitors such as Microsoft's ASP. What is PHP? PHP is an acronym for "PHP Hypertext Preprocessor“ Hypertext pre-processor - Interpreter of PHP code, processes PHP code invoked by web server and send pure HTML code to browser PHP is a widely-used, open source scripting language PHP costs nothing, it is free to download and use
Introduction What is PHP File? PHP files can contain text, HTML, CSS, JavaScript, and PHP code PHP code are executed on the server, and the result is returned to the browser as plain HTML PHP files have a file extension of ".php", ".php3", or ".phtml"
Introduction What can PHP do? PHP can generate dynamic page content PHP can create, open, read, write, and close files on the server PHP can deals with preservation of state management techniques like cookies, session PHP can perform database related operations like add, delete, modify data in your database PHP can restrict users to access some pages on your website PHP can encrypt data
Features PHP is free. Download it from the official PHP resource: Platform compatibility . PHP runs on various platforms (Windows, Linux, Unix etc.) Simple syntax Supports many databases likes mssql , oracle etc.. Broad functionality for network connectivity, file system support, COM, XML, Macromedia Flash. A vibrant and supportive community
How php script works?
Example: <html> <title>my php page</title> <body> <?php echo "hello there!"; ?> </body> </html> Echo is a special statement in php for outputing data to the browser. At the end of each PHP statement we need to put a semicolon, i.e. " ; “ which indicate the end of a PHP statement and should never be forgotten.
8 HTML in a PHP page <head> <title>PHP Info</title> <?php print("PHP Stats on the Server"); ?> </head> <body> <?php phpinfo(); ?> And print some more text here! </body> </html> <script> block in <head> <script> block in <body> Language we are using is PHP Generate HTML “on the fly” with print(...);
PHP Comments <html> <body> <?php // This is a single line comment # This is also a single line comment /* This is a multiple lines comment block that spans over more than one line */ ?> </body> </html>
Variable Variables are used for storing values, like text strings, numbers or arrays. All variables in PHP start with a $ sign symbol. A variable name must start with a letter or an underscore "_" A variable name can only contain alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ ) A variable name should not contain spaces. If a variable name is more than one word, it should be separated with an underscore ($my_string), or with capitalization ($myString).
Variable PHP has no command for declaring a variable.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture