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 is used to add lists into <ul> and <ol> elements?
<dt> <dd> <li>
<ul>
 <li>http://coursesweb.net/html/</li>
 <li>http://coursesweb.net/css/</li>
</ul>
Which value of the "display" property creates a block box for the content and ads a bullet marker?
block list-item inline-block
.some_class {
  display: list-item;
}
Which instruction converts a JavaScript object into a JSON string.
JSON.parse() JSON.stringify eval()
var obj = {
 "courses": ["php", "javascript", "ajax"]
};
var jsonstr = JSON.stringify(obj);
alert(jsonstr);    // {"courses":["php","javascript","ajax"]}
Indicate the PHP class used to work with HTML and XML content in PHP.
stdClass PDO DOMDocument
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>';
$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
$elm = $dochtml->getElementById("dv1");
echo $elm->nodeValue;    // CoursesWeb.net
Numbers and mathematical 0perators

Last accessed pages

  1. SSEP - Site Search Engine PHP-Ajax (11575)
  2. Align DIVs on the same line (8478)
  3. Deco Tool (2719)
  4. jQuery Drag and Drop Rows between two similar Tables (12974)
  5. Creating Custom Colors (2363)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (526)
  2. The Mastery of Love (65)
  3. CSS cursor property - Custom Cursors (63)
  4. Read Excel file data in PHP - PhpExcelReader (59)
  5. PHP-MySQL free course, online tutorials PHP MySQL code (44)