Home > Backend Development > PHP Tutorial > The difference between prefix operators and postfix operators_PHP tutorial

The difference between prefix operators and postfix operators_PHP tutorial

WBOY
Release: 2016-07-14 10:08:34
Original
1475 people have browsed it

$a = 0;

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:
The difference between prefix operators and postfix operators_PHP tutorial
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}...
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template