SResok
2/9/2018 - 9:03 AM

Kleur en positie

Kleur en positie

<?php
/**
 * Created by PhpStorm.
 * User: Gebruiker
 * Date: 2/9/2018
 * Time: 9:57
 */

class kleurEnPos
{
	public $kleuren = array( 'oranje', 'blauw', 'groen', 'rood' );
	public $kanten = array('links','midden','rechts');

	function __construct ()
	{
		$this->shuffle();
	}

	public function getCurrent ()
	{
		return current($this->kleuren) .' '.current($this->kanten);
	}
	public function shuffle(){
		shuffle($this->kleuren);
	}
	public function next ()
	{
		if ( next($this->kleuren) === false )
		{
			reset($this->kleuren);
		}
		if ( next($this->kanten) === false )
		{
			reset($this->kanten);
		}
	}
}

$oKleurEnPos = new kleurEnPos();