Php-mysql Course

PHP has both integer and float (decimal) number types. These two types can be classified under the generic title numbers.
Valid numbers can be anything like:   8,   258,   -37,   89.25,   -3.5785,   5.5e2
- Number-type values are never quoted. The numbers added within quotes are strings with numeric values.
PHP supports a maximum integer of around two billion on most platforms (UNIX and Windows). With numbers larger than that, PHP will automatically use a floating-point type.

1. Numbers and Operator

The mathematical operators are specific symbols that performs mathematical calculations.
Operators act on the variables and numbers presented in PHP instructions.

The standard mathematical (Arithmetic) operators


Assignment Operators


The mathematical calculations in PHP, as in arithmetic, are taken into account the operators precedence (the order in which complex calculations are made). If you want to force the execution order, you must group clauses in parentheses. Check the fallowing example:
<?php
$x = 8 + 3 * 5 -2;
echo $x;                  // 21 (first 3*5 [15], then adds 8 and substract 2 )

$x = (8+3) * (5-2);
echo '<br />'. $x;        // 33  (first 8+3  [11], then  5-2 [3], then makes the multiplication  11*3 [33] )
?>

2. PHP mathematical functions

Along with the arithmetic operators you can use PHP mathematical functions for more complex operations.
Here are some examples of functions:

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag renders as emphasized text, displaying the text oblique?
<strong> <pre> <em>
<p>Web development courses: <em>CoursesWeb.net</em></p>
Which CSS property defines the space between the element border and its content?
margin padding position
h3 {
  padding: 2px 0.2em;
}
Click on the method which returns the first element that matches a specified group of selectors.
getElementsByName() querySelector() querySelectorAll()
// gets first Div with class="cls", and shows its content
var elm = document.querySelector("div.cls");
alert(elm.innerHTML);
Indicate the PHP variable that contains data from a form sent with method="post".
$_SESSION $_GET $_POST
if(isset($_POST["field"])) {
  echo $_POST["field"];
}
Numbers and mathematical 0perators

Last accessed pages

  1. PHP getElementById and getElementsByTagName (49135)
  2. Remove / Get duplicate array values - Reset array keys in PHP (13039)
  3. Convert XML to JSON in JavaScript (33937)
  4. Voting Poll System script PHP-AJAX (8608)
  5. SHA1 Encrypt data in JavaScript (35310)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (235)
  2. Read Excel file data in PHP - PhpExcelReader (83)
  3. PHP Unzipper - Extract Zip, Rar Archives (72)
  4. The Four Agreements (69)
  5. The Mastery of Love (59)