PHP Classes

File: alternarColor.php

Recommend this page to a friend!
  Classes of Alfredo Rahn   AlternarColor array iterator   alternarColor.php   Download  
File: alternarColor.php
Role: Class source
Content type: text/plain
Description: This is the main class
Class: AlternarColor array iterator
Loop an array endlesly, returns current element
Author: By
Last change:
Date: 18 years ago
Size: 787 bytes
 

Contents

Class file image Download
<?php
/**
* Alterna los colores para fondo
*
* @author Alfredo Rahn <arahn@yahoo.com>
* @version 0.1 (09-08-2005)
*/
class alternarColor {
   
/**
     * Colores entre los que se puede alternar
     * @var array
     */
   
var $colores;
   
/**
     * Color actual
     * @var integer
     */
   
var $color;
   
/**
    * Constructor de la clase
    * @param array $colorin Lista de los colores para alternar
    */
   
function alternarColor ($colorin = array("darkred","yellow","darkgreen")) {
       
$this->colores = $colorin;
       
$this->color = -1;
    }
   
/**
    * Incrementa la posición e imprime el nombre de color correspondiente
    */
   
function imprimir () {
        (++
$this->color >= count($this->colores)) and $this->color = 0;
        return
$this->colores[$this->color];
    }
}
?>