RUVIDEO
Поделитесь видео 🙏

Arithmetic Operators - PHP - P16 смотреть онлайн

Arithmetic deals with the study of numbers, especially with operations on those numbers, such as addition, subtraction, multiplication, and division. In mathematics, those operations are called arithmetic operations. Arithmetic operators are then the operators that are used in arithmetic operations.

In PHP, we have a few arithmetic operators. They include: addition, subtraction, multiplication, division, modulus, and exponential operators.

Let's just run through the basic ones first. I mean, after all, it is just basic math.

$a = 2 + 2; // $a = 4
$b = 5 - 3; // $b = 2
$c = $a * $b; // $b = 8
$d = $c / 2; // $d = 4

Let's take a look at the modulus operator in more detail. It confuses people, but it's literally just the remainder. If you do elementary division, and you say 3/2, that equals 1 with a remainder of 1. Two goes into three 1 time, and there's one left over. That remainder of 1 is what the modulus operator produces.

The modulus operator is represented with the percentage symbol %.

$e = $d % 2;
// $e = 4 % 2
// $e = 0 since there's no remainder
$f = 5 % 2;
// $f = 1 since there's a remainder of 1

The exponential operator just raises the number to the power provided. So if you said 2³, that just equals 2 * 2 * 2, which is 8. The exponential operator in PHP is expressed using the double asterisk symbol (**).

$g = 2 ** 3;
// $g = 2^3
// $g = 8

You're not limited to using one arithmetic operator per expression. The operations follow the same precedence as in math. For example, the multiplication operator is executed before the addition operator. 

Let's see how PHP would evaluate this expression.

$h = $a + $b * $c;
// $h = $a + ($b * $c)
// $h = $a + (2 * $c)
// Remember, $c = $a * $b
// $h = $a + (2 * ($a * $b))
// $h = $a + (2 * (4 * 2))
// $h = $a + (2 * 8)
// $h = $a + 16
// $h = 4 + 16
// $h = 20

Once we finish going through all of the operators in PHP, we're going to look at operator precedence in detail in a later video.

Read the full article on my website
https://www.dinocajic.com/php-arithmetic-operators/

Code for this tutorial
https://github.com/dinocajic/php-7-youtube-tutorials/blob/master/16%20Artihmetic%20Operators.php

Full Code
https://github.com/dinocajic/php-7-youtube-tutorials

PHP Playlist
https://www.youtube.com/playlist?list=PLbhJy0VhR6SAmoneYvF6Y_axQJKg7i50M

--
Dino Cajic
Author and Head of IT

Homepage: https://www.dinocajic.com
GitHub: https://github.com/dinocajic
Medium: https://medium.com/@dinocajic
Instagram: https://www.instagram.com/think.dino
LinkedIn: https://www.linkedin.com/in/dinocajic/
Twitter: https://twitter.com/dino_cajic

My Books
An Illustrative Introduction to Algorithms
https://www.amazon.com/dp/1686863268

Laravel Excel: Using Laravel to Import Data
https://amzn.to/4925ylw

Code Along With Me - PHP: From Basic to Advanced PHP Techniques
https://amzn.to/3M6tlGN

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Arithmetic Operators - PHP - P16» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.