{"id":117,"date":"2018-07-12T09:18:44","date_gmt":"2018-07-12T09:18:44","guid":{"rendered":"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=117"},"modified":"2018-12-07T09:15:40","modified_gmt":"2018-12-07T09:15:40","slug":"constant-expression-statements-and-php-control-statement","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/chapter\/constant-expression-statements-and-php-control-statement\/","title":{"rendered":"Constant, Expression statements and PHP Control Statement"},"content":{"raw":"<div><span style=\"float: right\"><a href=\"https:\/\/youtu.be\/LjKEhiVtoF0\" target=\"_blank\" rel=\"noopener\"><img src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a>\r\n<\/span><\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>Constant<\/strong>\r\n<ul>\r\n \t<li>Constant stores a value which cannot be changed during program execution.<\/li>\r\n \t<li>The syntax to define constant is: define(constantName, constantValue)<\/li>\r\n \t<li style=\"text-align: justify\">Though it is not rule, but to differentiate ConstantName from others, it is generally written in UPPERCASE letters.<\/li>\r\n \t<li>For example: define(\u201ePI\u201f,3.14)<\/li>\r\n \t<li>Create a constant. The name of constant is PI and the value for the constant is 3.14.<\/li>\r\n<\/ul>\r\nLet us take an example to demonstrate the use of constant.\r\n\r\n&nbsp;\r\n\r\n&lt;html&gt;\r\n\r\n&lt;body&gt;\r\n\r\n&lt;form method=\"post\" action=\"circlearea.php\"&gt;\r\n\r\nEnter Radious:\r\n\r\n&lt;input type=\"text\" name=\"radious\"&gt;\r\n\r\n&lt;br&gt;&lt;br&gt;\r\n\r\n&lt;input type=\"submit\" name=\"submit\" value=\"Submit\"&gt;\r\n\r\n&lt;input type=\"reset\" name=\"reset\" value=\"Reset\"&gt;\r\n\r\n&lt;\/form&gt;\r\n\r\n&nbsp;\r\n\r\n&lt;?php\r\n\r\n$r = $_POST['radious'];\r\n\r\ndefine('PI',3.14);\r\n\r\n$area = PI * $r * $r;\r\n\r\necho \"&lt;br&gt; Area of radious $r is $area sq meters\";\r\n\r\n?&gt;\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/body&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/html&gt;<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"size-full wp-image-120 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-79.png\" alt=\"\" width=\"500\" height=\"210\" \/>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the above example, constant PI is defined with value 3.14. The value of PI is used to calculate area of circle.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">From the above code, you can also observe that the HTML code can use in PHPfile. Here only a single file is used to do work of HTML \u2013 to get input from user \u2013 and PHP \u2013 process on input value; here it calculates area of a circle.<\/p>\r\n&nbsp;\r\n\r\n<strong>String Expression<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">An expression is a value. It can be a single value as default or it can be a resulted single value after a series of operations. It can be a combination of variable, values, operators or functions.<\/p>\r\n&nbsp;\r\n\r\nIn PHP, string expression can be written using \u201e\u201f (single quotes) or \u201c \u201c(double quotes).\r\n\r\nFor example:\r\n\r\n$name = \u2018Hiren\u2019;\r\n\r\nor\r\n\r\n$name = \u201cHiren\u201d;\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">You can use empty double quotes (\u201e\u201f\u201c) or single quotes (\u201e\u201f) also to assign to a variable. Null is a special value which can be assigned to variable. Null is a special value. Null is different from empty string (\u201e\u201f\u201d). Null is not case sensitive. So null or NULL behaves the same way.<\/p>\r\n&nbsp;\r\n\r\n$address = \u2018\u2019;\r\n\r\n$address = NULL;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">To insert a variable value into a string is known as interpolation. When double quotes (\u201c \u201c) are used, PHP interpreter will check the entire string to see that is there any variables which need to be inserted into the string. While single quote (\u201e \u201f) will not insert variable value into string. Hence PHP works more efficiently when \u201e \u201e is used for string. Let\u201fs take one example:<\/p>\r\n&nbsp;\r\n\r\n&lt;?php\r\n\r\n$a = 10;\r\n\r\n$b = \"10\";\r\n\r\n$c = $a + $b;\r\n\r\necho \"value of c is $c\";\r\n\r\n$d = '10';\r\n\r\n$e = $a+ $d;\r\n\r\necho \"&lt;br&gt;\";\r\n\r\necho 'value of e is $e';\r\n\r\n?&gt;\r\n\r\n&nbsp;\r\n\r\nWhen you execute the program, the output will be\r\n\r\n&nbsp;\r\n\r\nvalue of c is 20\r\n\r\nvalue of e is $e\r\n\r\n&nbsp;\r\n\r\nYou can combine single and double quote for writing in quotes.\r\n\r\n&nbsp;\r\n\r\ne.x.:\r\n\r\n<\/div>\r\n<div>\r\n\r\n\u00a0 \u00a0 \u00a0&lt;?php\r\n\r\n$name = \"O'Brien\";\r\n\r\necho $name;\r\n\r\necho \"&lt;br&gt;\";\r\n\r\n$line = 'She said, \"Hi!\" ';\r\n\r\necho $line;\r\n\r\necho \"&lt;br&gt;\";\r\n\r\n$quotes = \"quotation is: 'will will find the way' \";\r\n\r\necho $quotes;\r\n\r\necho \"&lt;br&gt;\";\r\n\r\n?&gt;\r\n\r\n&nbsp;\r\n\r\nThe output of the above will be\r\n\r\n&nbsp;\r\n\r\nO'Brien\r\n\r\nShe said, \"Hi!\"\r\n\r\nquotation is: 'will will find the way'\r\n\r\n&nbsp;\r\n\r\nTo join or concatenate two or more strings the concatenation operator (.) is used.\r\n\r\n&nbsp;\r\n\r\nFor example:\r\n\r\n$fname = \u2018Hiren\u2019;\r\n\r\n$lname = \u2018Joshi\u2019;\r\n\r\n$fullname = $name.\u2019 \u2018.$laname\u00a0\u00a0 \/\/ Hiren Joshi\r\n\r\n$price = 19;\r\n\r\n$ans = \u2018Price : \u2018.$price; \/\/ Price : 19;\r\n\r\n&nbsp;\r\n\r\n<\/div>\r\n<div>\r\n<p style=\"text-align: left\"><strong>\u00a0 \u00a0 Numeric Expression<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Following operators are used for numeric expression:<\/p>\r\n\r\n<table class=\"aligncenter\" style=\"height: 308px\" border=\"1\">\r\n<tbody>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 63.0625px\"><strong>Operator<\/strong><\/td>\r\n<td style=\"height: 28px;width: 94.0625px\"><strong>Description<\/strong><\/td>\r\n<td style=\"height: 28px;width: 62.0625px\"><strong>Example<\/strong><\/td>\r\n<td style=\"height: 28px;width: 152.063px\"><strong>Result<\/strong><\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 63.0625px\">+<\/td>\r\n<td style=\"height: 28px;width: 94.0625px\">Addition<\/td>\r\n<td style=\"height: 28px;width: 62.0625px\">7 + 3<\/td>\r\n<td style=\"height: 28px;width: 152.063px\">10<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 63.0625px\">-<\/td>\r\n<td style=\"height: 28px;width: 94.0625px\">Subtraction<\/td>\r\n<td style=\"height: 28px;width: 62.0625px\">7 \u2013 3<\/td>\r\n<td style=\"height: 28px;width: 152.063px\">4<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 63.0625px\">*<\/td>\r\n<td style=\"height: 28px;width: 94.0625px\">Multiplication<\/td>\r\n<td style=\"height: 28px;width: 62.0625px\">7 * 3<\/td>\r\n<td style=\"height: 28px;width: 152.063px\">21<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 63.0625px\">\/<\/td>\r\n<td style=\"height: 28px;width: 94.0625px\">Division<\/td>\r\n<td style=\"height: 28px;width: 62.0625px\">7\/3<\/td>\r\n<td style=\"height: 28px;width: 152.063px\">2.33<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 63.0625px\">%<\/td>\r\n<td style=\"height: 28px;width: 94.0625px\">Modulus<\/td>\r\n<td style=\"height: 28px;width: 62.0625px\">7%3<\/td>\r\n<td style=\"height: 28px;width: 152.063px\">1<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 63.0625px\">++<\/td>\r\n<td style=\"height: 28px;width: 94.0625px\">Increment<\/td>\r\n<td style=\"height: 28px;width: 62.0625px\">$count++<\/td>\r\n<td style=\"height: 28px;width: 152.063px\">Adds 1 to count<\/td>\r\n<\/tr>\r\n<tr style=\"height: 28px\">\r\n<td style=\"height: 28px;width: 63.0625px\">--<\/td>\r\n<td style=\"height: 28px;width: 94.0625px\">Decrement<\/td>\r\n<td style=\"height: 28px;width: 62.0625px\">$count--<\/td>\r\n<td style=\"height: 28px;width: 152.063px\">Subtracts 1 from count<\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<p style=\"text-align: justify\">When an expression having two or more operators, the order of precede is determines which operators are applied first.<\/p>\r\n<img class=\"alignnone size-full wp-image-121 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-80.png\" alt=\"\" width=\"665\" height=\"219\" \/>\r\n<p style=\"text-align: justify\">Order of precedence can be override by using parentheses. The expression in parentheses is evaluated first.<\/p>\r\n&nbsp;\r\n\r\nFor example:\r\n\r\n7 + 3 * 5 will give you result 22 where as\r\n\r\n(7+ 3) * 5 will give you result 50\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>Compound Assignment Operator:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">To perform an operation on a variable and assign the result to the same variable, compound assignment statement is used. The compound operators are:<\/p>\r\n&nbsp;\r\n\r\n<img class=\"size-full wp-image-122 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-81.png\" alt=\"\" width=\"651\" height=\"329\" \/>\r\n\r\n&nbsp;\r\n\r\n<strong>Introduction to Control Statement:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Control Statements allow you to control the execution of PHP statements. The control statements include branching statement, iterative statements.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">To work with control statements, first we need to understand various operators. These operators are used in conditional expression. Conditional expression compares two expression and return TRUE or FALSE. If the condition is matched, it returns true otherwise false. For example, if we compare, $name == \u201cHiren\u201d, it will return true, only if $name has value Hiren.<\/p>\r\n&nbsp;\r\n\r\nIn the same way, it can work for $price == 10.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The == symbol is read as equal to. It compares the value is equal or not. The following table shows various relation operators.<\/p>\r\n&nbsp;\r\n\r\n<strong>Relational Operators<\/strong>\r\n\r\n&nbsp;\r\n\r\n<img class=\"alignnone size-full wp-image-123 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-82.png\" alt=\"\" width=\"646\" height=\"546\" \/>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The &amp;&amp; operator evaluate true only when all the condition are evaluate as true. The || operator evaluates true when any one conditions of the all condition is true. The ! operator will change the boolean value means true become false or false becomes true.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">When two or more conditional expressions are joined using logical operator, it is known as compound expression.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">In case a relational operator is used to compare two different data type, PHP automatically converts the data type to the same data type and attempts to perform the comparison. For example, if you write, $a=18, $b = \u201e18\u201f, then $a == $b will be evaluated as true because PHP converts both the values to the same data type and then convert.<\/p>\r\n&nbsp;\r\n\r\nNot equal is compare not equality between two expressions.\r\n\r\n&nbsp;\r\n\r\nAll these relational operators are binary as it requires two operands (values) and one operator.\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>Branching Statement<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">If statement allows you control the execution of statements. If statement can only executes one or more php statement(s) only when the conditional expression is evaluated as true.<\/p>\r\n&nbsp;\r\n\r\nFor example:\r\n\r\n&nbsp;\r\n\r\nif ($age &gt;= 18)\r\n\r\n{\r\n\r\necho \u201cYou are eligible for voting\u201d;\r\n\r\n}\r\n\r\n&nbsp;\r\n\r\nThe general syntax of if statement is:\r\n\r\nif (conditional expression)\r\n\r\n{\r\n\r\nstatement(s);\r\n\r\n}\r\n\r\n[else if (conditional expression)\r\n\r\n{\r\n\r\nstatement(s);\r\n\r\n}\r\n\r\nelse if(conditional expression)\r\n\r\n{\r\n\r\nstatement(s);\r\n\r\n}\r\n\r\nelse\r\n\r\n{\r\n\r\nstatement(s);\r\n\r\n}]\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The if statement can have one or more else if statement and else statement. The else if and else statements are optional. It can possible that after if statement immediately else statement is written. The else block will be executed as the condition for if block evaluated as false. A block means all the PHP statements inside the curly braces { }. It can possible that as per requirement there is only if block is coded.<\/p>\r\n&nbsp;\r\n\r\nExample 1:\r\n\r\n&nbsp;\r\n\r\n$name = \"Vimal\";\r\n\r\nif($name != Null)\r\n\r\n{\r\n\r\necho \"Welcome $name\";\r\n\r\n}\r\n\r\necho \"&lt;br&gt; You are out of if blcok.\" ;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Example 1 demonstrates the use of if block. There is only one if block. In PHP code, there can be more than one if block. In this example, $name is not null, hence the condition becomes true. So it will show, Welcome Vimal. Then if block completes, so after it, echo statement display You are out of if block.<\/p>\r\n&nbsp;\r\n\r\n<strong>Example 2:<\/strong>\r\n\r\n&nbsp;\r\n\r\nif($amt == null)\r\n\r\n{\r\n\r\necho \"&lt;br&gt; You must enter amount\";\r\n\r\n}\r\n\r\nelse if($amt &lt;= 0)\r\n\r\n{\r\n\r\necho \"Amount must be greater than or equal to zero\";\r\n\r\n}\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In Example 2, the variable $amt is not set. So, the messages of undefined variable is display and the condition $amt == null is true, so in the browser it will display You must enter amount.<\/p>\r\n&nbsp;\r\n\r\n<\/div>\r\n<div>\r\n<p style=\"text-align: justify\">\u00a0The conditional expression evaluate as false, the statements after the if block will be executed. If block consist of opening and closing braces pair after the if statement.<\/p>\r\n&nbsp;\r\n\r\n<strong>Example 3:<\/strong>\r\n\r\n&nbsp;\r\n\r\n$age = 18;\r\n\r\nif ($age &gt;= 18)\r\n\r\n{\r\n\r\necho \"&lt;br&gt; You are eligible for voting\";\r\n\r\necho \"&lt;br&gt; You are eligible for driving license of a car\";\r\n\r\n}\r\n\r\necho \"&lt;br&gt; Your age is less than 18\";\r\n\r\n&nbsp;\r\n\r\nThe output of example 3 is\r\n\r\n&nbsp;\r\n\r\nYou are eligible for voting\r\n\r\nYou are eligible for driving license of a car\r\n\r\nYour age is less than 18\r\n\r\n&nbsp;\r\n\r\nBecause though the condition for if statement is true, after if block there is not echo statement is executed.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The if \u2013else if \u2013else statement can be nested. That means in else \u2013if or else block another if \u2013else if \u2013 else statement written.<\/p>\r\n&nbsp;\r\n\r\n<strong>Switch Statement:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Switch statement can select one of many blocks of code to be executed. Switch statement be used instead of if-else if \u2013 else ladder.<\/p>\r\n&nbsp;\r\n\r\nSwitch statement works with simple data type integer, string or float.\r\n\r\n&nbsp;\r\n\r\nThe general syntax for switch statement is:\r\n\r\n&nbsp;\r\n\r\nSwitch (switch expression)\r\n\r\n{\r\n\r\ncase &lt;case label 1&gt;:\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">code to be executed for case label 1;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">b<\/span><span style=\"text-align: initial;font-size: 1em\">reak;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">case &lt;case lable 2&gt;:<\/span><span style=\"text-align: initial;font-size: 1em\">code to be executed for case label 1;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">break;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">\u2026.<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">[default:<\/span><span style=\"text-align: initial;font-size: 1em\">code to be executed for case label 1;b<\/span><span style=\"text-align: initial;font-size: 1em\">reak;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">}<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The switch expression in switch statement is returning a single value. This value is used to determine the case code to be executed. The switch expression can be a number or single variable or it may be a complex expression. The break statement is not compulsory though we have to use otherwise after the particular matching case is executed, it will also execute the next cases.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">To understand the utility of switch, let us write the program first using if \u2013else if \u2013 else and then using switch statement.<\/p>\r\n&nbsp;\r\n\r\n$grade = \"B\";\r\n\r\nif ($grade == 'A')\r\n\r\n{\r\n\r\n$message = 'well above average';\r\n\r\necho $message;\r\n\r\n}\r\n\r\nelse if ($grade == 'B')\r\n\r\n{\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">$message = 'above average';<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">echo $message;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">}<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">else if ($grade == 'C')<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">{<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">$message = 'average';<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">echo $message;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">}<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">else if ($grade == 'D')<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">{<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">$message = 'below average';<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">echo $message;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">}<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">else if ($grade == 'F')<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">{<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">$message = 'below average';<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">echo $message;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">}<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">else<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">{<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">$message = 'invalid grade';<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">\u00a0echo $message;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">}<\/span>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">When the code is executed, it will display above average at the browser.<\/span><span style=\"text-align: initial;font-size: 1em\">Now write the program using switch statement .<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n\u00a0 \u00a0 $grade = \"B\";\r\n\r\nswitch($grade)\r\n\r\n{\r\n\r\ncase 'A':\r\n\r\n$message = 'well above average';\r\n\r\necho $message;\r\n\r\nbreak;\r\n\r\ncase 'B':\r\n\r\n$message = 'above average';\r\n\r\necho $message;\r\n\r\nbreak;\r\n\r\ncase 'C':\r\n\r\n$message = 'average';\r\n\r\necho $message;\r\n\r\nbreak;\r\n\r\ncase 'D':\r\n\r\n$message = 'below average';\r\n\r\necho $message;\r\n\r\nbreak;\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">case 'F':<\/span><span style=\"font-size: 1em;text-align: initial\">$message = 'failing';<\/span>\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">echo $message;<\/span>\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">break;<\/span>\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">default:<\/span>\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">$message = 'invalid grade';<\/span>\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">echo $message;<\/span>\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">break;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">}<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\nWhen the code is executed, it will display above average at the browser.\r\n\r\n&nbsp;\r\n\r\nIf $grade = \u2018Z\u2019, then the program will display invalid grade.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">If break statement is not written in none of the case, it will not break out of the switch block. Hence the code execute for all the cases after matching case.<\/p>\r\n&nbsp;\r\n\r\nFor example,\r\n\r\n$grade = \"B\";\r\n\r\nswitch($grade)\r\n\r\n{\r\n\r\ncase 'A':\r\n\r\n$message = 'well above average';\r\n\r\necho \"&lt;br&gt;\".$message;\r\n\r\n&nbsp;\r\n\r\ncase 'B':\r\n\r\n$message = 'above average';\r\n\r\necho \"&lt;br&gt;\".$message;\r\n\r\n<\/div>\r\n<div>\r\n\r\n\u00a0 \u00a0case 'C':\r\n\r\n$message = 'average';\r\n\r\necho \"&lt;br&gt;\".$message;\r\n\r\n&nbsp;\r\n\r\ncase 'D':\r\n\r\n$message = 'below average';\r\n\r\necho \"&lt;br&gt;\".$message;\r\n\r\n&nbsp;\r\n\r\ncase 'F':\r\n\r\n$message = 'failing';\r\n\r\necho \"&lt;br&gt;\".$message;\r\n\r\n&nbsp;\r\n\r\ndefault:\r\n\r\n$message = 'invalid grade';\r\n\r\necho \"&lt;br&gt;\".$message;\r\n\r\n&nbsp;\r\n\r\n}\r\n\r\n&nbsp;\r\n\r\nThen the output is:\r\n\r\nabove average\r\n\r\naverage\r\n\r\nbelow average\r\n\r\nfailing\r\n\r\ninvalid grade\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">It is always a good practice to write break statement for each case<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<strong>\u00a0 \u00a0<\/strong>\r\n\r\n<strong> \u00a0Iterative Statements<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Iterative statements are statements which are executed till the condition expression is satisfied.While and for are iterative statements. These are also known as while loop and for loop.<\/p>\r\n&nbsp;\r\n\r\nThe general structure for while loop is:\r\n\r\n&nbsp;\r\n\r\nInitialize a variable\r\n\r\nWhile(condition)\r\n\r\n{\r\n\r\nStatement(s);\r\n\r\nInitialized variable increment\/decrement;\r\n\r\n}\r\n\r\n&nbsp;\r\n\r\nFor example:\r\n\r\n$i = 1;\r\n\r\nWhile($i &lt;= 10)\r\n\r\n{\r\n\r\nEcho \u201c$i &lt;br&gt;\u201d;\r\n\r\n$i = $i + 1; \/\/ you can write as $i += 1 ;\r\n\r\n}\r\n\r\n&nbsp;\r\n\r\nThe above code will print 1 to 10. Each number is printed in new line.\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The while statement check the condition and execute while block till the condition evaluate as true. When the condition is false (in this case, $i = 11), the statement goes out of the while block.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">If the condition is not false, the loop will be continue for infinite time. This type of loop is known as infinite loop.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">For example, following code shows an infinite loop which print 1 continuously.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n$i = 1;\r\n\r\nWhile($i &lt;= 10)\r\n\r\n{\r\n\r\necho \"$i &lt;br&gt;\";\r\n\r\n}\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The same program can be written by using for loop. For statement provides initializing, condition testing and increment, decrement in single line.<\/p>\r\n&nbsp;\r\n\r\nfor($i=1;$i&lt;=10;$i++)\r\n\r\n{\r\n\r\necho \"$i &lt;br&gt;\";\r\n\r\n}\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In a while or for loop, you can use break statement to break the loop. The continue statement is used to continue the execution.<\/p>\r\n&nbsp;\r\n\r\n$i = 1;\r\n\r\nwhile($i &lt;= 10)\r\n\r\n{\r\n\r\necho \"$i &lt;br&gt;\";\r\n\r\n$i = $i + 1; \/\/ you can write as $i += 1 ;\r\n\r\nif($i == 6)\r\n\r\n{\r\n\r\nbreak;\r\n\r\n}\r\n\r\n}\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The above code snippet will print the value 1 2 3 4 5 . Each number is printed on new line. As the value of variable $i becomes 6, the code is break from while loop.<\/p>\r\n&nbsp;\r\n\r\n$i = 1;\r\n\r\nwhile($i &lt;= 10)\r\n\r\n{\r\n\r\necho \"$i &lt;br&gt;\";\r\n\r\n$i = $i + 1; \/\/ you can write as $i += 1 ;\r\n\r\nif($i == 6)\r\n\r\n{\r\n\r\ncontinue;\r\n\r\n}\r\n\r\n}\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The above code snippet will print the value 1 2 3 4 5 6 7 8 9 10. Each number is printed on new line. As the value of variable $i becomes 6, the code is continue and is not terminated until the condition evaluates to false.<\/p>\r\n&nbsp;\r\n\r\n$i = 1;\r\n\r\nwhile($i &lt;= 10)\r\n\r\n{\r\n\r\necho \"$i &lt;br&gt;\";\r\n\r\n$i = $i + 1; \/\/ you can write as $i += 1 ;\r\n\r\nif($i == 6)\r\n\r\n{\r\n\r\nbreak;\r\n\r\n}\r\n\r\n}\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: justify;font-size: 1em\">The above code snippet will print the value 1 2 3 4 5. Each number is printed on new line. As the value of variable $i becomes 6, it is terminate from loop.<\/span><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">The same way you can use break and continue statement in for loop.<\/span><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"font-size: 1em\">Do while loop is a loop which works same as while loop except that the statement execute at least once in do while even though the condition is false. For example,<\/span><\/p>\r\n\r\n<\/div>\r\n&nbsp;\r\n\r\n$i = 10;\r\n\r\ndo\r\n\r\n{\r\n\r\necho \"$i &lt;br&gt;\";\r\n\r\n$i = $i +1;\r\n\r\n}while ($i &lt;= 5)\r\n<p style=\"text-align: justify\">The above code will print 10 as first it execute echo statement and then check the condition.<\/p>\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>you can view video on Constant, Expression statements and PHP Control Statement<\/strong><\/td>\r\n<td><a href=\"https:\/\/youtu.be\/LjKEhiVtoF0\" target=\"_blank\" rel=\"noopener\"><img class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n<strong>References:<\/strong>\r\n<ul>\r\n \t<li style=\"text-align: justify\">Luke Welling, Laura Thomson: PHP and MySQL Web Development, Pearson,<\/li>\r\n \t<li style=\"text-align: justify\">W. Jason Gilmore: Beginning PHP and MySQL 5 From Novice to Professional,Apress<\/li>\r\n \t<li style=\"text-align: justify\">Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K.<\/li>\r\n \t<li style=\"text-align: justify\">Glass: Beginning PHP5, Apache, and MySQL Web Development, Wrox,<\/li>\r\n \t<li style=\"text-align: justify\">Robin Nixon: Learning PHP, MySQL, and JavaScript, O'Reilly Media<\/li>\r\n \t<li style=\"text-align: justify\">Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove:Professional PHP, Wrox<\/li>\r\n \t<li style=\"text-align: justify\">Tim Converse, Joyce Park, Clark Morgan: PHP5 and MySQL Bible.<\/li>\r\n \t<li style=\"text-align: justify\">Joel Murach, Ray Harris: Murach\u2019s PHP and MySQL, Shroff\/Murach<\/li>\r\n \t<li style=\"text-align: justify\">Ivan Bayross, Web Enabled Commercial Application Development Using<\/li>\r\n \t<li style=\"text-align: justify\">HTML\/Javascript\/DHTML\/PHP , BPB Publications<\/li>\r\n \t<li style=\"text-align: justify\">Julie C. Meloni, Sams Teach Yourself PHP, MySQL and Apache All in One, Sams<\/li>\r\n \t<li style=\"text-align: justify\">Larry Ullman, PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide,Pearson Education.<\/li>\r\n \t<li style=\"text-align: justify\">http:\/\/www.php.net.<\/li>\r\n \t<li style=\"text-align: justify\">http:\/\/www.w3schools.com\/<\/li>\r\n \t<li style=\"text-align: justify\">http:\/\/www.tutorialspoint.com\/<\/li>\r\n<\/ul>","rendered":"<div><span style=\"float: right\"><a href=\"https:\/\/youtu.be\/LjKEhiVtoF0\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a><br \/>\n<\/span><\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Constant<\/strong><\/p>\n<ul>\n<li>Constant stores a value which cannot be changed during program execution.<\/li>\n<li>The syntax to define constant is: define(constantName, constantValue)<\/li>\n<li style=\"text-align: justify\">Though it is not rule, but to differentiate ConstantName from others, it is generally written in UPPERCASE letters.<\/li>\n<li>For example: define(\u201ePI\u201f,3.14)<\/li>\n<li>Create a constant. The name of constant is PI and the value for the constant is 3.14.<\/li>\n<\/ul>\n<p>Let us take an example to demonstrate the use of constant.<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;html&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>&lt;form method=&#8221;post&#8221; action=&#8221;circlearea.php&#8221;&gt;<\/p>\n<p>Enter Radious:<\/p>\n<p>&lt;input type=&#8221;text&#8221; name=&#8221;radious&#8221;&gt;<\/p>\n<p>&lt;br&gt;&lt;br&gt;<\/p>\n<p>&lt;input type=&#8221;submit&#8221; name=&#8221;submit&#8221; value=&#8221;Submit&#8221;&gt;<\/p>\n<p>&lt;input type=&#8221;reset&#8221; name=&#8221;reset&#8221; value=&#8221;Reset&#8221;&gt;<\/p>\n<p>&lt;\/form&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;?php<\/p>\n<p>$r = $_POST[&#8216;radious&#8217;];<\/p>\n<p>define(&#8216;PI&#8217;,3.14);<\/p>\n<p>$area = PI * $r * $r;<\/p>\n<p>echo &#8220;&lt;br&gt; Area of radious $r is $area sq meters&#8221;;<\/p>\n<p>?&gt;<\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/body&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/html&gt;<\/span><\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-120 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-79.png\" alt=\"\" width=\"500\" height=\"210\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-79.png 500w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-79-300x126.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-79-65x27.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-79-225x95.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-79-350x147.png 350w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the above example, constant PI is defined with value 3.14. The value of PI is used to calculate area of circle.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">From the above code, you can also observe that the HTML code can use in PHPfile. Here only a single file is used to do work of HTML \u2013 to get input from user \u2013 and PHP \u2013 process on input value; here it calculates area of a circle.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>String Expression<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">An expression is a value. It can be a single value as default or it can be a resulted single value after a series of operations. It can be a combination of variable, values, operators or functions.<\/p>\n<p>&nbsp;<\/p>\n<p>In PHP, string expression can be written using \u201e\u201f (single quotes) or \u201c \u201c(double quotes).<\/p>\n<p>For example:<\/p>\n<p>$name = \u2018Hiren\u2019;<\/p>\n<p>or<\/p>\n<p>$name = \u201cHiren\u201d;<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">You can use empty double quotes (\u201e\u201f\u201c) or single quotes (\u201e\u201f) also to assign to a variable. Null is a special value which can be assigned to variable. Null is a special value. Null is different from empty string (\u201e\u201f\u201d). Null is not case sensitive. So null or NULL behaves the same way.<\/p>\n<p>&nbsp;<\/p>\n<p>$address = \u2018\u2019;<\/p>\n<p>$address = NULL;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To insert a variable value into a string is known as interpolation. When double quotes (\u201c \u201c) are used, PHP interpreter will check the entire string to see that is there any variables which need to be inserted into the string. While single quote (\u201e \u201f) will not insert variable value into string. Hence PHP works more efficiently when \u201e \u201e is used for string. Let\u201fs take one example:<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;?php<\/p>\n<p>$a = 10;<\/p>\n<p>$b = &#8220;10&#8221;;<\/p>\n<p>$c = $a + $b;<\/p>\n<p>echo &#8220;value of c is $c&#8221;;<\/p>\n<p>$d = &#8217;10&#8217;;<\/p>\n<p>$e = $a+ $d;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;;<\/p>\n<p>echo &#8216;value of e is $e&#8217;;<\/p>\n<p>?&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>When you execute the program, the output will be<\/p>\n<p>&nbsp;<\/p>\n<p>value of c is 20<\/p>\n<p>value of e is $e<\/p>\n<p>&nbsp;<\/p>\n<p>You can combine single and double quote for writing in quotes.<\/p>\n<p>&nbsp;<\/p>\n<p>e.x.:<\/p>\n<\/div>\n<div>\n<p>\u00a0 \u00a0 \u00a0&lt;?php<\/p>\n<p>$name = &#8220;O&#8217;Brien&#8221;;<\/p>\n<p>echo $name;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;;<\/p>\n<p>$line = &#8216;She said, &#8220;Hi!&#8221; &#8216;;<\/p>\n<p>echo $line;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;;<\/p>\n<p>$quotes = &#8220;quotation is: &#8216;will will find the way&#8217; &#8220;;<\/p>\n<p>echo $quotes;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;;<\/p>\n<p>?&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>The output of the above will be<\/p>\n<p>&nbsp;<\/p>\n<p>O&#8217;Brien<\/p>\n<p>She said, &#8220;Hi!&#8221;<\/p>\n<p>quotation is: &#8216;will will find the way&#8217;<\/p>\n<p>&nbsp;<\/p>\n<p>To join or concatenate two or more strings the concatenation operator (.) is used.<\/p>\n<p>&nbsp;<\/p>\n<p>For example:<\/p>\n<p>$fname = \u2018Hiren\u2019;<\/p>\n<p>$lname = \u2018Joshi\u2019;<\/p>\n<p>$fullname = $name.\u2019 \u2018.$laname\u00a0\u00a0 \/\/ Hiren Joshi<\/p>\n<p>$price = 19;<\/p>\n<p>$ans = \u2018Price : \u2018.$price; \/\/ Price : 19;<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div>\n<p style=\"text-align: left\"><strong>\u00a0 \u00a0 Numeric Expression<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Following operators are used for numeric expression:<\/p>\n<table class=\"aligncenter\" style=\"height: 308px\">\n<tbody>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 63.0625px\"><strong>Operator<\/strong><\/td>\n<td style=\"height: 28px;width: 94.0625px\"><strong>Description<\/strong><\/td>\n<td style=\"height: 28px;width: 62.0625px\"><strong>Example<\/strong><\/td>\n<td style=\"height: 28px;width: 152.063px\"><strong>Result<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 63.0625px\">+<\/td>\n<td style=\"height: 28px;width: 94.0625px\">Addition<\/td>\n<td style=\"height: 28px;width: 62.0625px\">7 + 3<\/td>\n<td style=\"height: 28px;width: 152.063px\">10<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 63.0625px\">&#8211;<\/td>\n<td style=\"height: 28px;width: 94.0625px\">Subtraction<\/td>\n<td style=\"height: 28px;width: 62.0625px\">7 \u2013 3<\/td>\n<td style=\"height: 28px;width: 152.063px\">4<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 63.0625px\">*<\/td>\n<td style=\"height: 28px;width: 94.0625px\">Multiplication<\/td>\n<td style=\"height: 28px;width: 62.0625px\">7 * 3<\/td>\n<td style=\"height: 28px;width: 152.063px\">21<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 63.0625px\">\/<\/td>\n<td style=\"height: 28px;width: 94.0625px\">Division<\/td>\n<td style=\"height: 28px;width: 62.0625px\">7\/3<\/td>\n<td style=\"height: 28px;width: 152.063px\">2.33<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 63.0625px\">%<\/td>\n<td style=\"height: 28px;width: 94.0625px\">Modulus<\/td>\n<td style=\"height: 28px;width: 62.0625px\">7%3<\/td>\n<td style=\"height: 28px;width: 152.063px\">1<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 63.0625px\">++<\/td>\n<td style=\"height: 28px;width: 94.0625px\">Increment<\/td>\n<td style=\"height: 28px;width: 62.0625px\">$count++<\/td>\n<td style=\"height: 28px;width: 152.063px\">Adds 1 to count<\/td>\n<\/tr>\n<tr style=\"height: 28px\">\n<td style=\"height: 28px;width: 63.0625px\">&#8212;<\/td>\n<td style=\"height: 28px;width: 94.0625px\">Decrement<\/td>\n<td style=\"height: 28px;width: 62.0625px\">$count&#8211;<\/td>\n<td style=\"height: 28px;width: 152.063px\">Subtracts 1 from count<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"text-align: justify\">When an expression having two or more operators, the order of precede is determines which operators are applied first.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-121 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-80.png\" alt=\"\" width=\"665\" height=\"219\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-80.png 665w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-80-300x99.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-80-65x21.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-80-225x74.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-80-350x115.png 350w\" sizes=\"auto, (max-width: 665px) 100vw, 665px\" \/><\/p>\n<p style=\"text-align: justify\">Order of precedence can be override by using parentheses. The expression in parentheses is evaluated first.<\/p>\n<p>&nbsp;<\/p>\n<p>For example:<\/p>\n<p>7 + 3 * 5 will give you result 22 where as<\/p>\n<p>(7+ 3) * 5 will give you result 50<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>Compound Assignment Operator:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To perform an operation on a variable and assign the result to the same variable, compound assignment statement is used. The compound operators are:<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-122 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-81.png\" alt=\"\" width=\"651\" height=\"329\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-81.png 651w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-81-300x152.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-81-65x33.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-81-225x114.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-81-350x177.png 350w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Introduction to Control Statement:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Control Statements allow you to control the execution of PHP statements. The control statements include branching statement, iterative statements.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To work with control statements, first we need to understand various operators. These operators are used in conditional expression. Conditional expression compares two expression and return TRUE or FALSE. If the condition is matched, it returns true otherwise false. For example, if we compare, $name == \u201cHiren\u201d, it will return true, only if $name has value Hiren.<\/p>\n<p>&nbsp;<\/p>\n<p>In the same way, it can work for $price == 10.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The == symbol is read as equal to. It compares the value is equal or not. The following table shows various relation operators.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Relational Operators<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-123 aligncenter\" src=\"http:\/\/itp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/29\/2018\/07\/1-82.png\" alt=\"\" width=\"646\" height=\"546\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-82.png 646w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-82-300x254.png 300w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-82-65x55.png 65w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-82-225x190.png 225w, https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-content\/uploads\/sites\/29\/2018\/07\/1-82-350x296.png 350w\" sizes=\"auto, (max-width: 646px) 100vw, 646px\" \/><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The &amp;&amp; operator evaluate true only when all the condition are evaluate as true. The || operator evaluates true when any one conditions of the all condition is true. The ! operator will change the boolean value means true become false or false becomes true.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">When two or more conditional expressions are joined using logical operator, it is known as compound expression.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In case a relational operator is used to compare two different data type, PHP automatically converts the data type to the same data type and attempts to perform the comparison. For example, if you write, $a=18, $b = \u201e18\u201f, then $a == $b will be evaluated as true because PHP converts both the values to the same data type and then convert.<\/p>\n<p>&nbsp;<\/p>\n<p>Not equal is compare not equality between two expressions.<\/p>\n<p>&nbsp;<\/p>\n<p>All these relational operators are binary as it requires two operands (values) and one operator.<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>Branching Statement<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">If statement allows you control the execution of statements. If statement can only executes one or more php statement(s) only when the conditional expression is evaluated as true.<\/p>\n<p>&nbsp;<\/p>\n<p>For example:<\/p>\n<p>&nbsp;<\/p>\n<p>if ($age &gt;= 18)<\/p>\n<p>{<\/p>\n<p>echo \u201cYou are eligible for voting\u201d;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>The general syntax of if statement is:<\/p>\n<p>if (conditional expression)<\/p>\n<p>{<\/p>\n<p>statement(s);<\/p>\n<p>}<\/p>\n<p>[else if (conditional expression)<\/p>\n<p>{<\/p>\n<p>statement(s);<\/p>\n<p>}<\/p>\n<p>else if(conditional expression)<\/p>\n<p>{<\/p>\n<p>statement(s);<\/p>\n<p>}<\/p>\n<p>else<\/p>\n<p>{<\/p>\n<p>statement(s);<\/p>\n<p>}]<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The if statement can have one or more else if statement and else statement. The else if and else statements are optional. It can possible that after if statement immediately else statement is written. The else block will be executed as the condition for if block evaluated as false. A block means all the PHP statements inside the curly braces { }. It can possible that as per requirement there is only if block is coded.<\/p>\n<p>&nbsp;<\/p>\n<p>Example 1:<\/p>\n<p>&nbsp;<\/p>\n<p>$name = &#8220;Vimal&#8221;;<\/p>\n<p>if($name != Null)<\/p>\n<p>{<\/p>\n<p>echo &#8220;Welcome $name&#8221;;<\/p>\n<p>}<\/p>\n<p>echo &#8220;&lt;br&gt; You are out of if blcok.&#8221; ;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Example 1 demonstrates the use of if block. There is only one if block. In PHP code, there can be more than one if block. In this example, $name is not null, hence the condition becomes true. So it will show, Welcome Vimal. Then if block completes, so after it, echo statement display You are out of if block.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example 2:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>if($amt == null)<\/p>\n<p>{<\/p>\n<p>echo &#8220;&lt;br&gt; You must enter amount&#8221;;<\/p>\n<p>}<\/p>\n<p>else if($amt &lt;= 0)<\/p>\n<p>{<\/p>\n<p>echo &#8220;Amount must be greater than or equal to zero&#8221;;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In Example 2, the variable $amt is not set. So, the messages of undefined variable is display and the condition $amt == null is true, so in the browser it will display You must enter amount.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div>\n<p style=\"text-align: justify\">\u00a0The conditional expression evaluate as false, the statements after the if block will be executed. If block consist of opening and closing braces pair after the if statement.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example 3:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>$age = 18;<\/p>\n<p>if ($age &gt;= 18)<\/p>\n<p>{<\/p>\n<p>echo &#8220;&lt;br&gt; You are eligible for voting&#8221;;<\/p>\n<p>echo &#8220;&lt;br&gt; You are eligible for driving license of a car&#8221;;<\/p>\n<p>}<\/p>\n<p>echo &#8220;&lt;br&gt; Your age is less than 18&#8221;;<\/p>\n<p>&nbsp;<\/p>\n<p>The output of example 3 is<\/p>\n<p>&nbsp;<\/p>\n<p>You are eligible for voting<\/p>\n<p>You are eligible for driving license of a car<\/p>\n<p>Your age is less than 18<\/p>\n<p>&nbsp;<\/p>\n<p>Because though the condition for if statement is true, after if block there is not echo statement is executed.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The if \u2013else if \u2013else statement can be nested. That means in else \u2013if or else block another if \u2013else if \u2013 else statement written.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Switch Statement:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Switch statement can select one of many blocks of code to be executed. Switch statement be used instead of if-else if \u2013 else ladder.<\/p>\n<p>&nbsp;<\/p>\n<p>Switch statement works with simple data type integer, string or float.<\/p>\n<p>&nbsp;<\/p>\n<p>The general syntax for switch statement is:<\/p>\n<p>&nbsp;<\/p>\n<p>Switch (switch expression)<\/p>\n<p>{<\/p>\n<p>case &lt;case label 1&gt;:<\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">code to be executed for case label 1;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">b<\/span><span style=\"text-align: initial;font-size: 1em\">reak;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">case &lt;case lable 2&gt;:<\/span><span style=\"text-align: initial;font-size: 1em\">code to be executed for case label 1;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">break;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">\u2026.<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">[default:<\/span><span style=\"text-align: initial;font-size: 1em\">code to be executed for case label 1;b<\/span><span style=\"text-align: initial;font-size: 1em\">reak;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">}<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The switch expression in switch statement is returning a single value. This value is used to determine the case code to be executed. The switch expression can be a number or single variable or it may be a complex expression. The break statement is not compulsory though we have to use otherwise after the particular matching case is executed, it will also execute the next cases.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">To understand the utility of switch, let us write the program first using if \u2013else if \u2013 else and then using switch statement.<\/p>\n<p>&nbsp;<\/p>\n<p>$grade = &#8220;B&#8221;;<\/p>\n<p>if ($grade == &#8216;A&#8217;)<\/p>\n<p>{<\/p>\n<p>$message = &#8216;well above average&#8217;;<\/p>\n<p>echo $message;<\/p>\n<p>}<\/p>\n<p>else if ($grade == &#8216;B&#8217;)<\/p>\n<p>{<\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">$message = &#8216;above average&#8217;;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">echo $message;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">}<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">else if ($grade == &#8216;C&#8217;)<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">{<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">$message = &#8216;average&#8217;;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">echo $message;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">}<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">else if ($grade == &#8216;D&#8217;)<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">{<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">$message = &#8216;below average&#8217;;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">echo $message;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">}<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">else if ($grade == &#8216;F&#8217;)<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">{<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">$message = &#8216;below average&#8217;;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">echo $message;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">}<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">else<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">{<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">$message = &#8216;invalid grade&#8217;;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">\u00a0echo $message;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">}<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">When the code is executed, it will display above average at the browser.<\/span><span style=\"text-align: initial;font-size: 1em\">Now write the program using switch statement .<\/span><\/p>\n<\/div>\n<div>\n<p>\u00a0 \u00a0 $grade = &#8220;B&#8221;;<\/p>\n<p>switch($grade)<\/p>\n<p>{<\/p>\n<p>case &#8216;A&#8217;:<\/p>\n<p>$message = &#8216;well above average&#8217;;<\/p>\n<p>echo $message;<\/p>\n<p>break;<\/p>\n<p>case &#8216;B&#8217;:<\/p>\n<p>$message = &#8216;above average&#8217;;<\/p>\n<p>echo $message;<\/p>\n<p>break;<\/p>\n<p>case &#8216;C&#8217;:<\/p>\n<p>$message = &#8216;average&#8217;;<\/p>\n<p>echo $message;<\/p>\n<p>break;<\/p>\n<p>case &#8216;D&#8217;:<\/p>\n<p>$message = &#8216;below average&#8217;;<\/p>\n<p>echo $message;<\/p>\n<p>break;<\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">case &#8216;F&#8217;:<\/span><span style=\"font-size: 1em;text-align: initial\">$message = &#8216;failing&#8217;;<\/span><\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">echo $message;<\/span><\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">break;<\/span><\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">default:<\/span><\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">$message = &#8216;invalid grade&#8217;;<\/span><\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">echo $message;<\/span><\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">break;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">}<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>When the code is executed, it will display above average at the browser.<\/p>\n<p>&nbsp;<\/p>\n<p>If $grade = \u2018Z\u2019, then the program will display invalid grade.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">If break statement is not written in none of the case, it will not break out of the switch block. Hence the code execute for all the cases after matching case.<\/p>\n<p>&nbsp;<\/p>\n<p>For example,<\/p>\n<p>$grade = &#8220;B&#8221;;<\/p>\n<p>switch($grade)<\/p>\n<p>{<\/p>\n<p>case &#8216;A&#8217;:<\/p>\n<p>$message = &#8216;well above average&#8217;;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;.$message;<\/p>\n<p>&nbsp;<\/p>\n<p>case &#8216;B&#8217;:<\/p>\n<p>$message = &#8216;above average&#8217;;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;.$message;<\/p>\n<\/div>\n<div>\n<p>\u00a0 \u00a0case &#8216;C&#8217;:<\/p>\n<p>$message = &#8216;average&#8217;;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;.$message;<\/p>\n<p>&nbsp;<\/p>\n<p>case &#8216;D&#8217;:<\/p>\n<p>$message = &#8216;below average&#8217;;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;.$message;<\/p>\n<p>&nbsp;<\/p>\n<p>case &#8216;F&#8217;:<\/p>\n<p>$message = &#8216;failing&#8217;;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;.$message;<\/p>\n<p>&nbsp;<\/p>\n<p>default:<\/p>\n<p>$message = &#8216;invalid grade&#8217;;<\/p>\n<p>echo &#8220;&lt;br&gt;&#8221;.$message;<\/p>\n<p>&nbsp;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>Then the output is:<\/p>\n<p>above average<\/p>\n<p>average<\/p>\n<p>below average<\/p>\n<p>failing<\/p>\n<p>invalid grade<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">It is always a good practice to write break statement for each case<\/p>\n<\/div>\n<div>\n<p><strong>\u00a0 \u00a0<\/strong><\/p>\n<p><strong> \u00a0Iterative Statements<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Iterative statements are statements which are executed till the condition expression is satisfied.While and for are iterative statements. These are also known as while loop and for loop.<\/p>\n<p>&nbsp;<\/p>\n<p>The general structure for while loop is:<\/p>\n<p>&nbsp;<\/p>\n<p>Initialize a variable<\/p>\n<p>While(condition)<\/p>\n<p>{<\/p>\n<p>Statement(s);<\/p>\n<p>Initialized variable increment\/decrement;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>For example:<\/p>\n<p>$i = 1;<\/p>\n<p>While($i &lt;= 10)<\/p>\n<p>{<\/p>\n<p>Echo \u201c$i &lt;br&gt;\u201d;<\/p>\n<p>$i = $i + 1; \/\/ you can write as $i += 1 ;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>The above code will print 1 to 10. Each number is printed in new line.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The while statement check the condition and execute while block till the condition evaluate as true. When the condition is false (in this case, $i = 11), the statement goes out of the while block.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">If the condition is not false, the loop will be continue for infinite time. This type of loop is known as infinite loop.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">For example, following code shows an infinite loop which print 1 continuously.<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>$i = 1;<\/p>\n<p>While($i &lt;= 10)<\/p>\n<p>{<\/p>\n<p>echo &#8220;$i &lt;br&gt;&#8221;;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The same program can be written by using for loop. For statement provides initializing, condition testing and increment, decrement in single line.<\/p>\n<p>&nbsp;<\/p>\n<p>for($i=1;$i&lt;=10;$i++)<\/p>\n<p>{<\/p>\n<p>echo &#8220;$i &lt;br&gt;&#8221;;<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In a while or for loop, you can use break statement to break the loop. The continue statement is used to continue the execution.<\/p>\n<p>&nbsp;<\/p>\n<p>$i = 1;<\/p>\n<p>while($i &lt;= 10)<\/p>\n<p>{<\/p>\n<p>echo &#8220;$i &lt;br&gt;&#8221;;<\/p>\n<p>$i = $i + 1; \/\/ you can write as $i += 1 ;<\/p>\n<p>if($i == 6)<\/p>\n<p>{<\/p>\n<p>break;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The above code snippet will print the value 1 2 3 4 5 . Each number is printed on new line. As the value of variable $i becomes 6, the code is break from while loop.<\/p>\n<p>&nbsp;<\/p>\n<p>$i = 1;<\/p>\n<p>while($i &lt;= 10)<\/p>\n<p>{<\/p>\n<p>echo &#8220;$i &lt;br&gt;&#8221;;<\/p>\n<p>$i = $i + 1; \/\/ you can write as $i += 1 ;<\/p>\n<p>if($i == 6)<\/p>\n<p>{<\/p>\n<p>continue;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The above code snippet will print the value 1 2 3 4 5 6 7 8 9 10. Each number is printed on new line. As the value of variable $i becomes 6, the code is continue and is not terminated until the condition evaluates to false.<\/p>\n<p>&nbsp;<\/p>\n<p>$i = 1;<\/p>\n<p>while($i &lt;= 10)<\/p>\n<p>{<\/p>\n<p>echo &#8220;$i &lt;br&gt;&#8221;;<\/p>\n<p>$i = $i + 1; \/\/ you can write as $i += 1 ;<\/p>\n<p>if($i == 6)<\/p>\n<p>{<\/p>\n<p>break;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: justify;font-size: 1em\">The above code snippet will print the value 1 2 3 4 5. Each number is printed on new line. As the value of variable $i becomes 6, it is terminate from loop.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">The same way you can use break and continue statement in for loop.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"font-size: 1em\">Do while loop is a loop which works same as while loop except that the statement execute at least once in do while even though the condition is false. For example,<\/span><\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p>$i = 10;<\/p>\n<p>do<\/p>\n<p>{<\/p>\n<p>echo &#8220;$i &lt;br&gt;&#8221;;<\/p>\n<p>$i = $i +1;<\/p>\n<p>}while ($i &lt;= 5)<\/p>\n<p style=\"text-align: justify\">The above code will print 10 as first it execute echo statement and then check the condition.<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>you can view video on Constant, Expression statements and PHP Control Statement<\/strong><\/td>\n<td><a href=\"https:\/\/youtu.be\/LjKEhiVtoF0\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>References:<\/strong><\/p>\n<ul>\n<li style=\"text-align: justify\">Luke Welling, Laura Thomson: PHP and MySQL Web Development, Pearson,<\/li>\n<li style=\"text-align: justify\">W. Jason Gilmore: Beginning PHP and MySQL 5 From Novice to Professional,Apress<\/li>\n<li style=\"text-align: justify\">Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K.<\/li>\n<li style=\"text-align: justify\">Glass: Beginning PHP5, Apache, and MySQL Web Development, Wrox,<\/li>\n<li style=\"text-align: justify\">Robin Nixon: Learning PHP, MySQL, and JavaScript, O&#8217;Reilly Media<\/li>\n<li style=\"text-align: justify\">Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove:Professional PHP, Wrox<\/li>\n<li style=\"text-align: justify\">Tim Converse, Joyce Park, Clark Morgan: PHP5 and MySQL Bible.<\/li>\n<li style=\"text-align: justify\">Joel Murach, Ray Harris: Murach\u2019s PHP and MySQL, Shroff\/Murach<\/li>\n<li style=\"text-align: justify\">Ivan Bayross, Web Enabled Commercial Application Development Using<\/li>\n<li style=\"text-align: justify\">HTML\/Javascript\/DHTML\/PHP , BPB Publications<\/li>\n<li style=\"text-align: justify\">Julie C. Meloni, Sams Teach Yourself PHP, MySQL and Apache All in One, Sams<\/li>\n<li style=\"text-align: justify\">Larry Ullman, PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide,Pearson Education.<\/li>\n<li style=\"text-align: justify\">http:\/\/www.php.net.<\/li>\n<li style=\"text-align: justify\">http:\/\/www.w3schools.com\/<\/li>\n<li style=\"text-align: justify\">http:\/\/www.tutorialspoint.com\/<\/li>\n<\/ul>\n","protected":false},"author":3,"menu_order":5,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["dr-hiren-joshi"],"pb_section_license":""},"chapter-type":[],"contributor":[59],"license":[],"class_list":["post-117","chapter","type-chapter","status-publish","hentry","contributor-dr-hiren-joshi"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters\/117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/users\/3"}],"version-history":[{"count":15,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters\/117\/revisions"}],"predecessor-version":[{"id":465,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters\/117\/revisions\/465"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapters\/117\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/media?parent=117"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/pressbooks\/v2\/chapter-type?post=117"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/contributor?post=117"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/itp9\/wp-json\/wp\/v2\/license?post=117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}