Ever need to provide a list of items/products ranked by their cumulative positive and negative ratings?  It's not as easy to do it well as you might think.  Still, there may be an answer:

We need to balance the proportion of positive ratings with the uncertainty of a small number of observations. Fortunately, the math for this was worked out in 1927 by Edwin B. Wilson. What we want to ask is: Given the ratings I have, there is a 95% chance that the "real" fraction of positive ratings is at least what? Wilson gives the answer.

Read: How Not To Sort By Average Rating

This "Terms of Service; Didn't Read" site has a neat idea:

ToS;DR aims at creating a transparent and peer-reviewed process to rate and analyse Terms of Service and Privacy Policies in order to create a rating from Class A to Class E.

Sadly, the site itself seems to have an inconsistent idea of what criteria each reviewed site should need to pass for an "A" grade.  Hopefully they get this organized, because seeing a clear and concise Terms of Service can be meaningful in choosing a service provider.

I've been working on some changes to the layout around here.  Hopefully things will not be in flux too long.  If there's something you came here expecting to find and you no longer see it, please let me know.

Sometimes you want to get an instance of an object in PHP and then use it immediately. The problem is that PHP syntax doesn't typically allow this. To explain, what you would really like to do is this:

$result = (new DB('connection string'))->query('SELECT 1');

Obviously, that doesn't work. But there is a way to get what you want by using a kind of factory method.

Normally, you have this:
class DB {...}

And you must do this:
$db = new DB('connection string'); $result = $db->query('SELECT 1');

If you have a class that extends BaseObject:
class DB extends BaseObject {...}

You can do this instead:
$result = DB::create('connection string')->query('SELECT 1');

The static create() method becomes available to any class that extends BaseObject, and can pass through parameters to the derived class constructor.
class BaseObject { public static function create() { $class = get_called_class(); $args = func_get_args(); $r_class = new \ReflectionClass($class); return $r_class->newInstanceArgs( $args ); } }

Want to suggest improvements? Please fork.