1 / 14

Learn PHP With Myassignmenthelp.net

Best Way to Learn PHP with www.myassignmenthelp.net

Download Presentation

Learn PHP With Myassignmenthelp.net

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. PHP (Hypertext Preprocessor) www.myassignmenthelp.net

  2. Overview of PHP • PHP stands for Hypertext Preprocessor • Created by Rasmus Lerdorf in 1995 • It is an open source software • It is server-side scripting language, like ASP and executed on the server • More functionality added (OOP features), database support, protocols and APIs • A language that combines elements of Perl, C, and Java • It is free to use and download • PHP files can contain text, HTML tags and scripts and file extension of ".php" or ".phtml“ • PHP files are returned to the browser as plain HTML  www.myassignmenthelp.net

  3. PHP Syntax • PHP code is executed on the server, and the plain HTML result is sent to the browser. • Syntax: It is starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document. • Comments in PHP • use // to make a single-line comment or /* and */ to make a large comment block. Www.myassignmenthelp.net

  4. PHP Language Basics • Constants, Data Types and Variables • Constants define a string or numeric value • Constants do not begin with a dollar sign • Examples: • define(“COMPANY”, “Acme Enterprises” ); • define(“YELLOW”, “#FFFF00”); • define(“PI”, 3.14); • define(“NL”, “<br>\n”); • Data types • Integers, doubles and strings • isValid = true; // Boolean • 25 // Integer • 3.14 // Double • ‘Four’ // String • “Total value” // Another string

  5. Variables • It is used to store information. • It is used for storing information, like text strings, numbers or arrays. • All variables in PHP start with a $ sign symbol. • The declaring a variable • String variable: • used to store and manipulate text • script assigns the text "Hello" to a string variable called $text: www.myassignmenthelp.net

  6. Operators • Arithmetic Operators • + (Addition), - (Subtraction), * (Multiplication), / (Division), % (Modulus ), ++ (Increment), -- (Decrement) • Assignment Operators • =, +=, -=, *=, /=, .=, %= • Comparison Operators • ==, !=, <>, >, <, >=, <= • Logical Operators • && (and), || (or), ! (not) www.myassignmenthelp.net

  7. Conditional Statements • if Statement • execute some code only if a specified condition is true • if...else Statement • execute some code if a condition is true and another code if the condition is false • if...elseif....else Statement • use this statement to select one of several blocks of code to be executed www.myassignmenthelp.net

  8. Switch Statement • Conditional statements are used to perform different actions based on different conditions. Syntax: www.myassignmenthelp.net

  9. Loops • while Loop • executes a block of code while a condition is true. • do...while Statement • always execute the block of code once, it will then check the condition, and repeat the loop while the condition is true. www.myassignmenthelp.net

  10. Loops (cont) • for Loop • The for loop is used when you know in advance how many times the script should run. • foreach Loop • The foreach loop is used to loop through arrays. www.myassignmenthelp.net

  11. Form • One of the main features in PHP is the ability to take user input and generate subsequent pages on the input. In this page, we will introduce the mechanism by which data is passes in PHP. • Let's consider the following two files: • query.php • result.php www.myassignmenthelp.net

  12. $_GET Function • The built-in $_GET function is used to collect values in a form with method="get". • When using method="get" in HTML forms, all variable names and values are displayed in the URL. • Information sent from a form with the GET method is visible to everyone and has limits on the amount of information to send. • When the user clicks the "Submit" button, the URL sent to the server could look something like this: www.myassignmenthelp.net

  13. $_POST Function • The built-in $_POST function is used to collect values from a form sent with method="post". • Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send and the variables are not displayed in the URL and 8 Mb max size for the POST method, by default also can be changed by setting the post_max_size in the php.ini file. • Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. www.myassignmenthelp.net

  14. Thank You www.myassignmenthelp.net

More Related