- property_exists: documentation ( source)
<?php
class GenericMessage {
protected $q;
}
class Message extends GenericMessage {
protected $p;
public function __set ($key, $value) {
if (!property_exists($this, $key)) {
echo "Key {$key} not found";
}
}
}
$m = new Message;
$m->p = 'p';
$m->q = 'q';