Phil: oop variablen in funktionen

Beitrag lesen

Also ganz klassisch so:

class test  
{  
	private $buchstabe = array('o','r','l','d');  
	  
	public function funct1()  
	{  
		$wort = 'W';  
		$wort .= $this->funct2();  
		return $wort;  
	}  
	  
	private function funct2()  
	{  
		$wort = '';  
		foreach($this->buchstabe as $row)  
		{  
			$wort .= $row;  
		}  
		return $wort;  
	}  
}  
  
$obj = new test();  
echo $obj->funct1();

-------------------------
Ausgabe 'World'