Home  >  Article  >  Backend Development  >  PHP code PHP simple interlaced color changing function implementation code original

PHP code PHP simple interlaced color changing function implementation code original

PHP中文网
PHP中文网Original
2016-07-28 08:27:231656browse

This article briefly analyzes the implementation method of simple interlaced color changing function in PHP. Share it with everyone for your reference. The details are as follows:

$color="";
echo "隔行变色效果:";
echo "";
for($i=1;$i<=5;$i++){
     if($i%2==0){
         $color="yellow";
     }
     if($i%2==1){
         $color="red";
     }
     echo "这是第".$i."行";
}
echo "";

I hope this article will be helpful for everyone to learn PHP programs.

The above introduces the PHP code. PHP simple interlaced color changing function implementation code is original, including PHP code content. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

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