class usage
| From: | benifactor | Date: | Fri, 29 Sep 2006 09:35:05 +0000 |
| Subject: | class usage | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-242389@lists.php.net to get a copy of this message | ||
ok, about five minutes ago i decided to learn classes and delve into php's oop side.
what i came up with was this...
//start example code
class newsletter {
function send ($email,$subject,$message) {
if ($email) {
echo("the following message was sent to: $email <br> subject:
$subject<br><br> $message");
}
else {
echo("failure");
}
}
}
$new = new newsletter();
$new->send("test@test.test", "test class", "test class worked, i have
passed and failed the test.");
//end code example
..and this seems to work fine, i could easily add the mail function and insert real variables into
send() but what i don't understand is i could also easily do this without a class... so i guess
the real question is what are some real life examples of class usage and why is it used as opposed
to regular non oop? thank you for any input into the subject that you may have.