Hi, I'm new to PHP, but not to the programming in general. Here I've tried to create a really basic class and to call it's method. But seems like I'm missing something basic... (I've followed the tutorial from here: http://www.spoono.com/php/tutorials/tutorial.php?id=27) Please, can you tell me what's wrong with the code below?
Here's the code for class:
<?php
class PageBody {
var $css = 'styles.css';
var $sorce = '';
var $div = '<div></div>';
var $img = '<img>';
var $pattern = '/></i';
var $replacement = 'class="$class_name"';
function PageBody () {
//$sorce = preg_replace($pattern, $replacement, $div);
}
function to_string () {
$output = $this->$div;
return $output;
}
}
?>
And here I'm trying to use it:
<?php
include('classes/page_template.php');
$page = new PageBody();
echo $page->to_string();
?>
TIA.