title: Abstract Static Function in PHP 5.3
body: <p>I'm a relative newcomer to PHP, and I'm figuring out the best way to implement some database access code.  I'm trying to create some simple database access objects -- each table gets its own class, each instance of the class represents a row in the table, you know the drill.</p>
  
  <p>I have code that seems to be working, but some of what I've seen online makes me worry that my approach may be wrong-headed somehow.  And since "Can I do this?" and "SHOULD I do this?" are two different questions, I was hoping some PHP vets could chime in.</p>
  
  <p>My current strategy is to create a base-level abstract Table class that contains all the common code and then have each class representing an individual table extend it.</p>
  
  <p>My main concern is this code:</p>
  
  <pre><code>
  abstract class Table {
      protected abstract static function get_fields();
      protected abstract static function get_primary_key();
      protected abstract static function get_table_name();
  </code></pre>
  
  <p>The idea is that each implementing class will define the field names, the primary key(s), the table name, etc., and then the Table class will use those functions to fill in specific blanks, like so:</p>
  
  <pre><code>
      static function insert($values) {
          $field_list = array();
          $value_list = array();
          foreach (static::get_fields() as $field_name) {
              if (isset($values[$field_name])) {
                  $field_list[] = $field_name;
                  $value_list[] = self::escape($values[$field_name]);
              }
          }
          $field_string = join(", ", $field_list);
          $value_string = "'" . join("', '", $value_list) . "'";
  
          $sql = "insert into " . static::get_table_name() . " ($field_string) values ($value_string)";
  </code></pre>
  
  <p>As you can see, the key is that I'm accessing those <code>static abstract</code> functions by prefacing them with <code>static::</code>.  And as far as I can tell, it's working!</p>
  
  <p>However, the accepted answer to <a href="https://stackoverflow.com/questions/999066/why-does-php-5-2-disallow-abstract-static-class-methods">this question</a> indicates that <code>abstract static</code> functions still aren't allowed in 5.3.</p>
  
  <p>So, I'm trying to figure out what to make of this.  Is the answer wrong -- are <code>abstract static</code> functions now considered perfectly legal PHP code?  Am I doing something inadvisable in my code?  Is there another approach I ought to consider?</p>