What the fck. I'm beyond frustrated right now. I've been playing with this fcking class the entire day and everything I see on php.net and various sites doesnt seem to work.
I need to set a constant variable in a class.
I've tried
class get_mail {
global $mailbox, $username, $password;
$mailbox = "INBOX";
}
and I get error
Parse error: syntax error, unexpected T_GLOBAL, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/public_html/ajaxemail/index.php on line 41
class get_mail {
var $mailbox = "INBOX";
}
and get error
Parse error: syntax error, unexpected '(', expecting ',' or ';' in /home/public_html/ajaxemail/index.php on line 41
global $mailbox, $username, $password;
class get_mail {
$mailbox = "INBOX";
}
and I get error
Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/otractco/public_html/micromanagersgroup/ajaxemail/index.php on line 43
Setting the global or public variable out of the class doesnt carry into it, and I cant seem to set anything but functions in a class.
I'm new to classes, thinking oop is what I should be focusing on now. But every example I see on how to carry a variable into a class doesn't seem to work. The only solution I have is to carry the variables into each function but that's tedious and I dont want to do that.
What am I doing wrong?
How can I get a variable into my class?
php 4.47