Topic awaiting preservation: Class help get instance name |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: |
posted 01-06-2010 18:37
Problem im trying to write reusable code that will automatically get the instance name. code: class Object() { public static nulls = array(blah blah blah); public static function fill_nulls($post, $object_name){ foreach(static::$nulls as $key => $val){ if($post[$val] == '' || !isset($post[$val])){ $$object_name->$key = "NULL"; } } } } $object = new Object();
|
Nervous Wreck (II) Inmate From: |
posted 01-13-2010 14:25
Not sure what you are trying to achieve. You can get the class name http://php.net/manual/en/function.get-class.php |