I'm working on PHP and to test my program I'm trying to make the simple lines of code that you see in the image
include("model\product.php");
$product = new Product();
$product->setName("Remera");
$product->setDescription("una remera nike");
$product->setPrice(400);
$product->setSex("M");
$product->setProductcode("AAA1");
echo $product->toString();
But at the moment of doing the new Product()
it gives me an error that does not know the class. Code of the Product class in PHP:
namespace model;
class Product
{
private $name;
private $description;
private $price;
private $productcode;
private $sex;
private $images = array();
public function __construct()
{
}
public function toString()
{
return $this->name." ".$this->price;
}
// Getters Setters