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

PHP code PHP simple interlaced color changing function implementation code original

PHP中文网
Release: 2016-07-28 08:27:23
Original
1729 people have browsed it

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 "";
Copy after login

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)!

Related labels:
php
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template