I am reading my books and trying to learn how to write classes. Why, because I know it will be much easier in the future to develop things in general.
SO below is the html page and the class. I am trying to just call a basic class and return a string variable to display. But All I get is "OBJECT"
What is wrong?
<?PHP
include("./includes/archive_class.php");
$display = new article_archive();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="600" align="center" cellpadding="5" cellspacing="5">
<tr>
<td>
<div align="Center" style="font-size:x-large"><?PHP echo $display; ?> </div>
</td>
</tr>
</table>
</div>
</body>
</html>
Class
class article_archive
{
function article_archive()
{
$string = "Function found";
return $string;
}
}
I have tried returning $this->$string and other variations but I am not getting anyhwere.
I think I need a better book to reference than my old PHP4 Bible.
Thanks