Hi,
I am getting this error. I dont know how to troubleshoot it. I am using XAMPP on Windows 8.1 machine.
Fatal error: Uncaught Error: Class ‘xampp\php\pear\Product’ not found in F:\xampp\htdocs\brackets-dev\index.php:11 Stack trace: #0 {main} thrown in F:\xampp\htdocs\brackets-dev\index.php on line 11
I have a class called Product in F:\xampp\php\pear\Product.php
include_path=F:\xampp\php\PEAR (php.ini)
[b]<?php
namespace \php\pear;
class Product
{
protected $name;
public function __construct($name)
{
$this->name = $name;
}
}[/b]
I am trying to instantiate this class in index.php which is in F:\xampp\htdocs\brackets-dev\index.php contains this code.
[b]<?php
include ‘Product.php’;
use xampp\php\pear\Product;
$product_one = new Product(‘colador’);
[/b]
I clearly have a issue with namespace definition and possibly use xampp\php\pear\Product
I have tried many things. Googling a lot… and nothing.
Help would be much much appreciated.
Thank you.