<?php 
class ShopProduct {

public $title;
public $content;

function __construct($title,$content) {
$this->title = $title;
$this->title = $content; }

function getProducer() 
{ return $this->title;
}
function getContent() 
{ return $this->content;
}

function foo() { echo "hello!";return 1;  }

// end class shop product
}

$product1 = new ShopProduct('Product 1','somegirls');
$product2 = new ShopProduct('Product 2','someguys');

print "this is {$product1->foo()}<br/>";
print "this is {$product1->getProducer()}<br/>";
print "this is {$product2->getContent()}<br/>";
?>

the result is .
hello!this is 1
this is somegirls ( the content show ? why not the title ? )
this is ( the content dont show here . )

please help me on this two question . thanks .

Adam Ramadhan

This is the problem, your assigning the wrong variable.

function __construct($title,$content) {
$this->title = $title;
$this->title = $content; }

Change $this->title to $this->content, and it should work just fine.

Hello,
everything is ok except

function __construct($title,$content) {
$this->title = $title;
$this->content = $content; }

Hope this will help you, whenever you find error, just go back from the print statement to the top of the code. You will find the error.