Location: PHPKode > projects > Finasystem > fs_ta/data.php
<?php


class data
{
	//class Data
	private $datetime;
	private $open;
	private $high;
	private $low;
	private $close;

	//class Methods
	function set_data($fichier)
	{
		$monfichier = fopen($fichier, "r+");
		while ($ligne = fgets($monfichier)) 
		{ 
			$array_ligne = explode(',', $ligne);
			$array_date = explode('/', $array_ligne[0]);

			$this->open[] = $array_ligne[1];
			$this->high[] = $array_ligne[2];
			$this->low[] = $array_ligne[3];
			$this->close[] = $array_ligne[4];
			$this->volume[] = $array_ligne[5];
		}
		
		fclose($monfichier);
	}
	
	function get_data($type)
	{
		if($type=="datetime")
		{
			return $this->datetime;
		}
		elseif($type=="open")
		{
			return $this->open;
		}
		elseif($type=="high")
		{
			return $this->high;
		}
		elseif($type=="low")
		{
			return $this->low;
		}
		elseif($type=="close")
		{
			return $this->close;
		}
		elseif($type=="volume")
		{
			return $this->volume;
		}
		else
		{
			return 0;
		}
	}
	
}

?>
Return current item: Finasystem