A Little Noise

15Nov/051

Static Variable Variables

<?php
  class A {
    static function b() {
      echo "It works\n";
    }
  }
  $theClass = "A";
  $x = new $theClass;

  /* Are any of the following legal? Which? */

  A::b();
  $x->b();
  $theClass::b();
?>

Show Answer ▼

Comments (1) Trackbacks (0)
  1. Have you actually tried running this? All three work. =b


Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

No trackbacks yet.