{"id":513,"date":"2022-12-01T09:09:13","date_gmt":"2022-12-01T09:09:13","guid":{"rendered":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/?p=513"},"modified":"2022-12-01T09:58:40","modified_gmt":"2022-12-01T09:58:40","slug":"operators","status":"publish","type":"post","link":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2022\/12\/01\/operators\/","title":{"rendered":"Operators"},"content":{"rendered":"\n<p>Operators let you specify mathematical operations to perform, such as addition, subtraction, multiplication, and division. But several other types of operators exist too, such as the string, comparison, and logical operators. Math in PHP looks a lot like plain arithmetic\u2014for instance, the following statement outputs 8:<\/p>\n\n\n\n<p>echo 6 + 2;<\/p>\n\n\n\n<p>Before moving on to learn what PHP can do for you, take a moment to learn about the various operators it provides.<br>Arithmetic operators Arithmetic operators do what you would expect\u2014they are used to perform mathematics.<br>You can use them for the main four operations (add, subtract, multiply, and divide) as well as to find a modulus (the remainder after a division) and to increment or decrement a value.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Operator Description    Example\n+        Addition       $j + 1\n-        Subtraction    $j - 6\n*        Multiplication $j * 11\n\/        Division       $j \/ 4\n%        Modulus        $j % 9\n++       Increment      ++$j\n--       Decrement      --$j\n**       Exponentiation $j**2<\/pre>\n\n\n\n<p>Assignment operators <br>These operators assign values to variables. They start with the very simple = and move on to +=, -=, and so on.<br>The operator += adds the value on the right side to the variable on the left, instead of totally replacing the value on the left.<br>Thus, if $count starts with the value 5, the statement:<br><strong>$count += 1;<\/strong><br>sets $count to 6, just like the more familiar assignment statement:<br><strong>$count = $count + 1;<\/strong><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Operators let you specify mathematical operations to perform, such as addition, subtraction, multiplication, and division. But several other types of operators exist too, such as the string, comparison, and logical operators. Math in PHP looks a lot like plain arithmetic\u2014for instance, the following statement outputs 8: echo 6 + 2; Before moving on to learn &hellip; <a href=\"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/2022\/12\/01\/operators\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Operators<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/513"}],"collection":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=513"}],"version-history":[{"count":5,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/513\/revisions"}],"predecessor-version":[{"id":541,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/513\/revisions\/541"}],"wp:attachment":[{"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=513"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/tietokanta.dy.fi:8243\/mikko\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}