Here's a handy little routine I just wrote to suggest properties you're
trying to erroneously set that don't exist in a class. For example:

Attempted to __get() non-existant property/variable 'operator_id' in class
checking for operator and suggesting the following:
    * id_operator
    * operator_name
    * operator_code
  * Suggests alternative properties should a __get() or __set() fail
  * @param  string $property
  * @return string
  * @author Daevid Vincent []
  * @date    05/12/09
  * @see  __get(), __set(), __call()
 public function suggest_alternative($property)
  $parts = explode('_',$property);
  foreach($parts as $i => $p) if ($p == '_' || $p == 'id')
  echo 'checking for <b>'.implode(', ',$parts)."</b> and suggesting the
  echo "<ul>";
     foreach($this as $key => $value)
   foreach($parts as $p)
    if (stripos($key, $p) !== false) print '<li>'.$key."</li>\n";
  echo "</ul>";
just put it in your __get() or __set() like so:
 public function __get($property)
      echo "<p><font color='#ff0000'>Attempted to __get() non-existant
property/variable '".$property."' in class

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to