"; \$txt2 = "CSCI165A students!"; echo \$txt1 . \$txt2; // you may use print instead of echo to output text to the browser... print \$txt1 . \$txt2; ?> *********************************************************** "; print "y = " . strval(\$y) . "
"; print "x + y = " . strval(\$x + \$y) . "
"; print "x - y = " . strval(\$x - \$y) . "
"; print "x * y = " . strval(\$x * \$y) . "
"; print "x / y = " . strval(\$x / \$y) . "
"; // % is the modulus operator: gives the remainder after an integer division print "x % y = " . strval(\$x % \$y) . "
"; // the following line adds one to the \$x variable \$x++; // the following line adds one to the \$y variable \$y++; print "x = " . strval(\$x) . "
"; print "y = " . strval(\$y) . "
"; print "x + y = " . strval(\$x + \$y) . "
"; print "x - y = " . strval(\$x - \$y) . "
"; print "x * y = " . strval(\$x * \$y) . "
"; print "x / y = " . strval(\$x / \$y) . "
"; // % is the modulus operator: gives the remainder after an integer division print "x % y = " . strval(\$x % \$y) . "
"; ?> *********************************************************** < >= <= != == // see: http://www.w3schools.com/php/php_operators.asp \$x = 10; \$y = 5; // Note: strval is a function to convert a number to a string // used like the Python str() function // when used with strings, the . will join (concatenate) strings print "x = " . strval(\$x) . "
"; print "y = " . strval(\$y) . "
"; if (\$x == \$y) { print "x is equal to y" . "
"; print "y is equal to x" . "
"; } else { print "x is NOT equal to y" . "
"; print "y is NOT equal to x" . "
"; } \$y = 10; print "x = " . strval(\$x) . "
"; print "y = " . strval(\$y) . "
"; if (\$x == \$y) { print "x is equal to y" . "
"; print "y is equal to x" . "
"; } else { print "x is NOT equal to y" . "
"; print "y is NOT equal to x" . "
"; } ?> *********************************************************** "; print "y = " . strval(\$y) . "
"; if ((\$x >= \$y) && (\$y == 5)) // both have to be true for the next statement to print { print "x is greater than or equal to y" . " AND " . "y is equal to 5" . "
"; } else // i.e. one of the above conditions must be false { print "Either x is less than y OR y is not equal to 5" . "
"; } \$y = 10; print "x = " . strval(\$x) . "
"; print "y = " . strval(\$y) . "
"; if ((\$x >= \$y) && (\$y == 5)) // both have to be true for the next statement to print { print "x is greater than or equal to y" . " AND " . "y is equal to 5" . "
"; } else // i.e. one of the above conditions must be false { print "Either x is less than y OR y is not equal to 5" . "
"; } ?> *********************************************************** "; \$i++; // this is the same as writing \$i = \$i + 1; } ?> *********************************************************** "; print "Hello World!
"; } ?> ***********************************************************
"; echo date("g:i A l, F j Y."); // g = the hour, in 12-hour format // i = minutes // A = print AM or PM, depending... // l = print the day of the week // F = print the month // j = print the day of the month // Y = print the year - all four digits ?> ***********************************************************