Ahh... ja danke! Du hast mir sogar sehr geholfen! Jetzt funktioniert es
.
Das mit dem Return im Konstruktor habe ich aus einem PEAR Package (Text_Password). Ich dachte damit könnte man erzwingen, dass die komplette Klasse "abgearbeitet" wird. So in der Art, dass sobald man $irgendwas = new Email(wert, wert, ...); schreibt, es diese auch sofort versendet, ohne erst eine weiter Funktion à la $irgendwas->_sendEmail aufrufen zu müssen. Aber nun weis ich ja, dass dies nicht möglich ist
.
auszug aus dem PEAR Package "Text_Password":
Author: Martin Jansen und Olivier Vanhoucke
PHP-Code:
class Text_Password {
function create($length = 10, $type = 'pronounceable', $chars = '')
{
switch ($type) {
case 'unpronounceable' :
return Text_Password::_createUnpronounceable($length, $chars);
case 'pronounceable' :
default :
return Text_Password::_createPronounceable($length);
}
}
// (...)
function _createPronounceable($length)
{
global $_Text_Password_NumberOfPossibleCharacters;
$retVal = '';
/**
* List of vowels and vowel sounds
*/
$v = array('a', 'e', 'i', 'o', 'u', 'ae', 'ou', 'io',
'ea', 'ou', 'ia', 'ai'
);
/**
* List of consonants and consonant sounds
*/
$c = array('b', 'c', 'd', 'g', 'h', 'j', 'k', 'l', 'm',
'n', 'p', 'r', 's', 't', 'u', 'v', 'w',
'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th',
'ch', 'ph', 'st', 'sl', 'cl'
);
$v_count = 12;
$c_count = 29;
$_Text_Password_NumberOfPossibleCharacters = $v_count + $c_count;
for ($i = 0; $i < $length; $i++) {
$retVal .= $c[mt_rand(0, $c_count-1)] . $v[mt_rand(0, $v_count-1)];
}
return substr($retVal, 0, $length);
}
// (...)
Dort funktioniert das einwandfrei ^^. Dass das natürlich nun gerade beim Konstruktor nicht funktioniert habe ich nicht gewusst.
Kann es sein das du JAVA "liebst"?
Danke nochmal!!!
MfG