Marcus Bointon wrote:
on 4/10/04 13:34, Christian Schneider at [EMAIL PROTECTED] wrote:


I dare to disagree. For tool functions it often makes sense to make them
statically callable while you still might want to use them in an object
instance context respecting the instance's state. It may seem a bit
hacky but I like PHP for being dynamic enough to allow this.


In this case I was writing a 'delete' method that would either delete the
current object's database record, or if passed an ID and called statically
(hence the need to detect it), the record corresponding to that id.

What about:

class A {

  function delete($id = null) {
     if(is_null($id)) {
        $id = $this->id;
     }



  }
}

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to