Function Overloading in PHP5 and PHP4

This is a solution to the problem of argument type based overloading in PHP. As far as I know this should work in PHP4 and PHP5.


class Viewer {
  function display($v) {
    $class = get_class($v);
    $function = "display_$class";
    if(method_exists($this, $function) ){
      $this->$function($v);
    } else {
      $this->display_default($v);
    }
  }
}

This class can then be extended and used like this:


class PDOViewer extends Viewer {
  function display_PDO($item) {
    echo "This is a PDO item";
  }
}
$viewer = new PDOViewer;
$viewer->display(new PDO);

Tagging Music

With the advancement of tags (and here and here), I’ve been thinking about new ways to use them. The best use I have thought about came about through Dave and my quest to sort our Mp3’s into a meaningful mess. Tags could easily solve the majority of our genre woes.

I have thought about using them in the grouping or comment section id3 tag and then by using smart playlists and the “contains” rule I can create the playlist I want. The problem starts when you want to edit the tag, you can’t mass edit the tags if there is something already in them, it erases the tag.

The simplest problems can always be the hardest to fix.

Volleyball Training

We had our first USQ volleyball training yesterday, we are hoping to train every Sunday afternoon almost for the rest of the year, it should be good. We tend to hit the pub afterwards.

There is a tournament in 2 or so weeks and we want to do pretty well.