It is possible - if you'll store static registry of used id's. That's about:
class NewClass
{
public $id;
//here's your registry
protected static $registry = array();
public function __construct($id)
{
$this->id = $id;
$this->checkVars();
//if not failed, add to registry:
self::$registry[] = $id;
}
public function checkVars()
{
if (empty($this->id))
{
trigger_error('ID is a required parameter.');
}
//checking if it's already used:
elseif (in_array($this->id, self::$registry))
{
trigger_error('ID "'.$this->id.'" was used already. Please insert a unique name.');
}
}
}
You can check this demo