Posts

PHP MYSQL - Operators - 5.6 String Operators

  PHP String Operators PHP has two operators that are specially designed for strings. Operator Name Example Result . Concatenation $txt1 . $txt2 Concatenation of $txt1 and $txt2 .= Concatenation assignment $txt1 .= $txt2 Appends $txt2 to $txt1 <!DOCTYPE html> <html> <body> <?php $txt1 = "Vesrn"; $txt2 = "Technologies"; echo $txt1 . $txt2; ?>   </body> </html> Output: VesrnTechnologies 2)<!DOCTYPE html> <html> <body> <?php $txt1 = "Vesrn; $txt2 = "Technologies!"; $txt1 .= $txt2; echo $txt1; ?>   </body> </html> Output: VesrnTechnologies

PHP MYSQL - Operators - 5.5 Logical Operators

 PHP MYSQL - Operators - 5.5 Logical Operators PHP Logical Operators The PHP logical operators are used to combine conditional statements. Operator Name Example Result and And $x and $y True if both $x and $y are true or Or $x or $y True if either $x or $y is true xor Xor $x xor $y True if either $x or $y is true, but not both && And $x && $y True if both $x and $y are true || Or $x || $y True if either $x or $y is true ! Not !$x True if $x is not true Example 'and' <!DOCTYPE html> <html> <body> <?php $x = 10;   $y = 20; if ($x == 100 and $y == 50) {     echo "Vesrn Technologies!"; } ?>   </body> </html> Output: Vesrn Technologies Logical operators are widely used when it necessary, dear student you can try remaining operators with your own.

PHP MYSQL - Operators - 5.4 Increment / Dercement Operators

  PHP Increment / Decrement Operators The PHP increment operators are used to increment a variable's value by adding one. The PHP decrement operators are used to decrement a variable's value by subtracting one. Operator Name Description ++$x Pre-increment Increments $x by one, then returns $x $x++ Post-increment Returns $x, then increments $x by one --$x Pre-decrement Decrements $x by one, then returns $x $x-- Post-decrement Returns $x, then decrements $x by one                               Example:  Prefix Increment Operator  <!DOCTYPE html> <html> <body> <?php $x = 10;   echo ++$x; ?>   </body> </html> Output: 11 Example:  Postfix Increment Operator  <!DOCTYPE html> <html> <body> <?php $x = 10;   echo $x++; ?>   </body> </html> Output: 10 Similarly prefix --, postfix -- operators works