The difference between prefix operators and postfix operators_PHP tutorial
- WBOYOriginal
- 2016-07-14 10:08:341493browse
echo "----------post-add operation---------
";
for($b = 0;$b <= 10;$b++){ //Use for loop statement
echo $a++." "; //Use postfix operator
}
echo "
----------prefixed addition---------
";
$d = 0; www.2cto.com
for($b = 0;$b <= 10;$b++){
echo ++$d." "; //Use postfix operator
}
echo "
----------Prepend subtraction operation---------
";
$f =10;
for($b = 10;$b >= 0;$b--){
echo --$f." ";
}
echo "
----------post-subtraction operation---------
";
$g =10;
for($b = 10;$b >= 0;$b--){
echo $g--." "; //Use postfix operator
}
?>
Result:
http://www.bkjia.com/PHPjc/477769.html
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477769.htmlTechArticle?php $a = 0; //Customize the variable and give the initial value echo ------ ----Post addition operation---------br; for($b = 0;$b = 10;$b++){ //Use the for loop statement echo $a++. ; //After use Set operator}...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn