matlab 运算子图

Today we will look into PHP operators. Earlier we went through PHP tutorial for beginners to get you started with variables and String.

今天,我们将研究PHP运算符。 之前,我们为初学者提供了PHP教程,以帮助您开始使用变量和String。

PHP运算子 (PHP Operators)

We can use PHP operators with String, integers, boolean and arrays.

我们可以将PHP运算符与String,integer,boolean和arrays一起使用。

PHP运算符类型 (PHP Operator Types)

PHP scripting language provides different kinds of operators to work with variables such as arithmetic operators, comparison and logical operators.

PHP脚本语言提供了各种运算符来使用变量,例如算术运算符,比较运算符和逻辑运算符。

  1. PHP Arithmetic OperatorsPHP算术运算符
  2. PHP Assignment OperatorsPHP赋值运算符
  3. PHP Increment/Decrement OperatorsPHP增/减运算符
  4. PHP Comparison OperatorsPHP比较运算符
  5. PHP Logical OperatorsPHP逻辑运算符
  6. PHP Bitwise OperatorsPHP按位运算符
  7. PHP Array OperatorsPHP数组运算符
  8. PHP Type OperatorPHP类型运算符

1. PHP算术运算符 (1. PHP Arithmetic Operators)

Operator Name Description
a+b Addition Sum of variables a and b, for example 2+3=5
a-b Subtraction Difference of a and b, for example 5-2=3
a*b Multiplication Product of a and b, for example 5*2=10
a/b Division Quotient of a and b, for example 10/2=5
a%b Modulus Remainder of a divided by b, for example 3%2=1
-a Negation Opposite of x, for example -5
a.b Concatenation Used to concat, for example “Pankaj” . “Kumar”=”PankajKumar”
操作员 名称 描述
a + b 加成 变量a和b的总和,例如2 + 3 = 5
b 减法 a和b之差,例如5-2 = 3
a * b 乘法 a和b的乘积,例如5 * 2 = 10
a / b a和b的商,例如10/2 = 5
a%b 模量 a的余数除以b,例如3%2 = 1
-一个 否定 与x相反,例如-5
b 级联 用于连接,例如“ Pankaj”。 “ Kumar” =“ PankajKumar”
<?php$a = 10;
$b = 5;
$c = 3;
$d = 8;//addition example
$add=$a + $b;
echo $add; //prints 15
echo "<br>";//subtraction example
$sub = $a - $b;
echo $sub; //prints 5
echo "<br>";//multiplication example
$mul = $a * $b;
echo $mul; //prints 50
echo "<br>";//division example
$div = $a / $b;
echo $div; // prints 2
echo "<br>";
echo $a/$c; //prints 3.3333333333333
echo "<br>";
echo $d/$c; //prints 2.6666666666667
echo "<br>";//modulus example
$mod= $a % $b;
echo $mod;
echo "<br>"; //prints 0//Negation example
$neg = -$a;
echo $neg; //prints -10;
echo "<br>";//Concatenation example
$str1="Pankaj";
$str2="Kumar";echo $str1 . " " . $str2; //prints "Pankaj Kumar"
echo "<br>";echo $a . $b; //prints 105
echo "<br>";echo $c . $d; //prints 38
?>

2. PHP赋值运算符 (2. PHP Assignment Operators)

Operator Description
a=b The value of b will be set to a, the left side can be expressions also, for example a= 10-5
a+=b Same as a=a+b
a-=b Same as a=a-b
a*=b Same as a=a*b
a/=b Same as a=a/b
a%=b Same as a=a%b
a.=b Same as a=a.b
操作员 描述
a = b b的值将设置为a,左侧也可以是表达式,例如a = 10-5
a + = b 与a = a + b相同
a- = b 与a = ab相同
a * = b 与a = a * b相同
a / = b 与a = a / b相同
a%= b 与a = a%b相同
a。= b 与a = ab相同
<?php$a=12;//assignment operator example
$b=$a;
echo $b; //prints 12
echo "<br>";$a+=$b;
echo $a; //prints 24, same as a=a+b
echo "<br>";$a-=$b;
echo $a; //prints 12, same as a=a-b=24-12
echo "<br>";$a*=$b;
echo $a; //prints 144, same as a=a*b=12*12
echo "<br>";$a/=$b;
echo $a; //prints 12, same as a=a/b=144/12
echo "<br>";$a%=$b;
echo $a; //prints 0, same as a=a%b=12%12
echo "<br>";$a.=$b;
echo $a; //prints 012, same as a=a.b=0.12=012?>

3. PHP增/减运算符 (3. PHP Increment/Decrement Operators)

Operator Name Description
++a Pre-increment Increment a by 1 and then returns it
a++ Post-increment returns a and then increment it by 1
–a Pre-decrement Decrement a by 1 and then returns it
a– Post-decrement returns a and then decrement it by 1
操作员 名称 描述
++一 预增量 将a递增1,然后返回
a ++ 后增量 返回a然后将其递增1
-一个 递减 将a减1,然后返回
一个- 递减后 返回a,然后减1
<?php$a=12;//Pre-increment example
$b=++$a;
echo "a=".$a." ,b=".$b; //prints a=13 ,b=13
echo "<br>";//Post-increment example
$b=$a++;
echo "a=".$a." ,b=".$b; //prints a=14 ,b=13
echo "<br>";//Pre-decrement example
$b=--$a;
echo "a=".$a." ,b=".$b; //prints a=13 ,b=13
echo "<br>";//Post-decrement example
$b=$a--;
echo "a=".$a." ,b=".$b; //prints a=12 ,b=13
echo "<br>";?>

4. PHP比较运算符 (4. PHP Comparison Operators)

Operator Name Description
a==b Equal True if a is equal to b
a===b Identical True if a is equal to b and of same type, 5===”5” is false
a!=b Not equal True if a and b are not equal
a<>b Not equal True if a and b are not equal
a!==b Not identical True if a and b are not equal and they are not of same type, for example 5!==”5″ returns true
a<b Less than True if a is less than b
a>b Greater than True if a is greater than b
a<=b Less than or equal to True if a is less than or equal to b
a>=b Greater than or equal to True if a is greater than or equal to b
操作员 名称 描述
a == b 等于 如果a等于b,则为真
a === b 相同 如果a等于b并且具有相同类型,则为true,则5 ===“ 5”为false
a!= b 不相等 如果a和b不相等则为真
a <> b 不相等 如果a和b不相等则为真
a!== b 不一样 如果a和b不相等并且不是同一类型,则为true,例如5!==“ 5”返回true
a <b 少于 如果a小于b,则为true
a> b 比...更棒 如果a大于b,则为true
a <= b 小于或等于 如果a小于或等于b,则为true
a> = b 大于或等于 如果a大于或等于b,则为true
<?php$a=10;
$b="10";
$c=10;
$d=5;//Equal example
var_dump($a==$b); //prints bool(true)
echo "<br>";
var_dump($a==$c); //prints bool(true)
echo "<br>";//Identical example
var_dump($a===$b); //prints bool(false)
echo "<br>";
var_dump($a===$c); //prints bool(true)
echo "<br>";//Not equal example
var_dump($a!=$b); //prints bool(false)
echo "<br>";
var_dump($a!=$c); //prints bool(false)
echo "<br>";
var_dump($a<>$b); //prints bool(false)
echo "<br>";
var_dump($a<>$c); //prints bool(false)
echo "<br>";//Not identical example
var_dump($a!==$b); //prints bool(true)
echo "<br>";
var_dump($a!==$c); //prints bool(false)
echo "<br>";//Less than example
var_dump($a<$b); //prints bool(false)
echo "<br>";
var_dump($a<$d); //prints bool(false)
echo "<br>";//Greater than example
var_dump($a>$b); //prints bool(false)
echo "<br>";
var_dump($a>$d); //prints bool(true)
echo "<br>";//Less than or equal to example
var_dump($a<=$b); //prints bool(true)
echo "<br>";
var_dump($a<=$d); //prints bool(false)
echo "<br>";//Greater than or equal to example
var_dump($a>=$b); //prints bool(true)
echo "<br>";
var_dump($a>=$d); //prints bool(true)
echo "<br>";?>

5. PHP逻辑运算符 (5. PHP Logical Operators)

Operator Name Description
a and b And True if both a and b are true
a or b Or True if either a or b is true
a xor b Xor True if either a or b is true, but not both
!a Not True if a is not true
a && b And Same as and operator
a || b Or Same as or operator
操作员 名称 描述
a和b 如果a和b都为真,则为真
a或b 要么 如果a或b为真,则为真
异或 异或 如果a或b为真,则为True,但不能同时为真
!一个 如果a不为真,则为真
a && b 与和运算符相同
|| b 要么 与或运算子相同
<?php$a=true;
$b=false;
$c=true;//And example
var_dump($a and $b); //prints bool(false)
var_dump($a and $c); //prints bool(true)var_dump($a && $b); //prints bool(false)
var_dump($a && $c); //prints bool(true)echo "<br>";//Or example
var_dump($a or $b); //prints bool(true)
var_dump($a or $c); //prints bool(true) var_dump($a || $b); //prints bool(true)
var_dump($a || $c); //prints bool(true)
echo "<br>";//Xor example
var_dump($a xor $b); //prints bool(true)
var_dump($a xor $c); //prints bool(false)
echo "<br>";//Not example
var_dump(!$a); //prints bool(false)
var_dump(!$b); //prints bool(true)
echo "<br>";?>

6. PHP按位运算符 (6. PHP Bitwise Operators)

Operator Name Description
a & b And Bits that are set in both a and b are set.
a | b Or Bits that are set in either a or b are set
a ^ b Xor Bits that are set in a or b but not both are set
~ a Not Bits that are set in a are not set, and vice versa
a << b Shift left Shift the bits of a, b steps to the left
a >> b Shift right Shift the bits of a, b steps to the right
操作员 名称 描述
a和b ab中设置的位均被置位。
一个| b 要么 设置在ab中设置的位
a ^ b 异或 ab中设置但未同时设置的位
〜一个 a中设置的位未设置,反之亦然
a << b 左移 a, b的位向左移动
a >> b 右移 a, b的位向右移动
<?php$a=15; // 00001111
$b=35; // 00100011//Bitwise And example
$c=$a & $b;
//  00001111
// &00100011
//  00000011echo $c; //prints 3
echo "<br>";//Bitwise Or example
$c=$a | $b;
//  00001111
// |00100011
//  00101111echo $c; //prints 47
echo "<br>";//Bitwise Xor example
$c=$a ^ $b;
//  00001111
// ^00100011
//  00101100echo $c; //prints 44
echo "<br>";//Bitwise Not example
$c=$a & ~$b; //bits that are set in a but not in b, 00001100 = 12
$d=$b & ~$a; //bits that are set in b but not in a, 00100000 = 32echo $c; //prints 12
echo "<br>";
echo $d; //prints 32
echo "<br>";//Shift left example
$c=$a<<2; //bits shifted to left two places, 00111100 = 60
echo $c; //prints 60
echo "<br>";//Shift right example
$c=$a>>2; //bits shifted to right two places, 00000011 = 3
echo $c; //prints 3?>

7. PHP数组运算符 (7. PHP Array Operators)

Operator Name Description
a + b Union Union of a and b
a == b Equality True if a and b have same key/value pairs
a === b Identity True if a and b have the same key/value pairs in the same order and of the same types.
a != b Inequality True if a is not equal to b
a <> b Inequality True if a is not equal to b
a !== b Non-Identity True if a is not identical to b
操作员 名称 描述
a + b 联盟 a和b的并集
a == b 平等 如果a和b具有相同的键/值对,则为true
a === b 身分识别 如果a和b具有相同顺序和相同类型的相同键/值对,则为true。
a!= b 不等式 如果a不等于b为真
a <> b 不等式 如果a不等于b为真
a!== b 非身份 如果a与b不相同,则为true
<?php$cars=array("BMW","Toyota","Honda");
$buses=array("BMW","Volvo","Tata","Mercedez");//Union of Arrays
$cars_buses = $cars + $buses;
$arrlength=count($cars_buses);for($x=0;$x<$arrlength;$x++){echo $cars_buses[$x] . " "; //prints "BMW Toyota Honda Mercedez "}
echo "<br>";//Arrays Equality
$cars1=array("BMW","2" => "Honda",1 => "Toyota");
var_dump($cars == $cars1); //prints bool(true);
var_dump($cars == $buses); //prints bool(false);
echo "<br>";//Identical Arrays operator
var_dump($cars === $cars1); //prints bool(false);
var_dump($cars === $buses); //prints bool(false);
echo "<br>";//Inequality example
var_dump($cars != $cars1); //prints bool(false);
var_dump($cars != $buses); //prints bool(true);
echo "<br>";var_dump($cars <> $cars1); //prints bool(false);
var_dump($cars <> $buses); //prints bool(true);
echo "<br>";//Non-Identical Arrays operator
var_dump($cars !== $cars1); //prints bool(true);
var_dump($cars !== $buses); //prints bool(true);
echo "<br>";?>

8. PHP类型运算符 (8. PHP Type Operator)

instanceof is the type operator used to determine if a PHP variable is an instantiated object of a class or not.

instanceof是用于确定PHP变量是否为类的实例化对象的类型运算符。

<?php
class MyClass{}class OtherClass{}$var = new MyClass;var_dump($var instanceof MyClass); // prints bool(true)
var_dump($var instanceof OtherClass); // prints bool(false)?>

That’s all for PHP operators. In the next tutorial, we will learn about PHP Conditional Statements, Arrays and Loops in PHP.

PHP运算符就这些了。 在下一个教程中,我们将学习PHP中PHP条件语句,数组和循环。

翻译自: https://www.journaldev.com/1477/php-operators

matlab 运算子图

matlab 运算子图_PHP运算子相关推荐

  1. python运算符and_Python AND运算子

    python运算符and Python operators can be divided into multiple categories. Two of them are – bitwise ope ...

  2. [转载] 不少Gate或Node运算子 的反向传播代码

    参考链接: Python运算子 https://github.com/vinhkhuc/MemN2N-babi-python/blob/master/memn2n/nn.py

  3. MATLAB运算总结(一)超详细

    1:乘方号^;如2的三次方即2^3.规则从左到右,先乘除后加减,否则加小括号.三角函数直接写入,圆周率Π:pi.表示e:exp(n)表示e的n次方.log()表示以e为底的对数.log2()表示以2为 ...

  4. matlab中voa,matlab 运算出错 function [w1,w2,VoA,VoB,VoC,VoD,VoE,VA1,VB1,VC1,

    matlab 运算出错 function [w1,w2,VoA,VoB,VoC,VoD,VoE,VA1,VB1,VC1, matlab 运算出错 function [w1,w2,VoA,VoB,VoC ...

  5. 【Python面试必看系列】之Python 中的三元运算子

    Q 4. 解释一下 Python 中的三元运算子 python中并没有c++中的三元算子 : c=a>b?a:b //意思是如果a>b就将a赋值给c,否则将b赋值给c. 但是python中 ...

  6. 实验一 MATLAB 运算基础

    实验一 MATLAB 运算基础 目录 实验一 MATLAB 运算基础 1.1实验目的 1.2实验内容 1.3流程图 1.4程序清单 1.5运行结果 1.6实验的收获与体会 1.1实验目的 1,熟悉启动 ...

  7. matlab subplot子图丢失,Matlab绘制子图subplot使用操作方法

    Matlab绘制子图subplot如何使用?下面是小编介绍Matlab绘制子图subplot使用操作方法,有需要的一起来下文看看吧,希望可以帮助到大家! Matlab绘制子图subplot使用操作方法 ...

  8. matlab 添加子图图案,matplotlib给子图添加图例的方法

    matplotlib给子图添加图例的方法 代码如下: import matplotlib.pyplot as plt x = [1,2,3,4,5,6,7,8] y = [5,2,4,2,1,4,5, ...

  9. 【Matlab】子图添加子序号 (a) (b) (c) 及调整子图间距边距 科研绘图

    子图添加序号 1. matlab中subplot子图使用title函数 title('(a)','position',[-4,38],'FontSize',16); 2. 使用xlabel函数 3. ...

最新文章

  1. ZeroMQ接口函数之 :zmq_strerror - 获取ZMQ错误描述字符串
  2. Java InputStream详解
  3. gdb调试fork+exec创建的子进程的方法
  4. 【深入Java虚拟机JVM 05】HotSpot对象探秘
  5. 科大星云诗社动态20201223
  6. 2016-05-12 SAP UI5事件注册的问题研究
  7. C语言编程快速入门黎明,何用C语言模拟键盘输入?
  8. Python求一个整数位数的方法
  9. 【HihoCoder - 1550】顺序三元组(思维)
  10. PyTorch【torchvision】
  11. JavaScript——BOM知识
  12. java printf
  13. Uncaught RangeError: Maximum call stack size exceeded 超出最大调用值(个人解释)
  14. 【每日一题(26)】初等排序算法(3) 插入排序 希尔排序 (更正)
  15. jsp:session的跟踪方式
  16. node爬取app数据_从零开始写一个node爬虫(上)—— 数据采集篇
  17. XMind 常用快捷键(思维导图总结)
  18. js中php遍历数组,vue.js如何遍历数组
  19. 人工智能有那三样核心要素?痛点又在那里呢?
  20. 360安全卫士直达 卸载软件的位置

热门文章

  1. salt一键部署jdk
  2. java变量和方法的覆盖和隐藏(翻译自Java Tutorials)
  3. 《面向对象程序设计》第六次作业(图形化界面)
  4. PHP运算符 - 对象的方法或者属性, =数组的元素值
  5. 【Oracle】删除重复记录
  6. server端多个文件的压缩 .NET
  7. [转载] python的面向对象和类与对象
  8. WEB 端批量移动设备管理控制工具 STF 的环境搭建和运行
  9. 并发入库面临重复数据的问题
  10. JS_模拟广告栏跟随效果