Archive for the ‘php’ Category
Very Simple (Pretend) SQL Paramaters
<?php /* Some hacked up code for Very Simple (Pretend) SQL Paramaters — For when you don’t have PDO, or just can’t be bothered Examples: >>> SQL("SELECT * FROM users WHERE id=? AND name LIKE ?", 123, ‘"123\"’); SELECT * FROM [...]
PHP interface for the DecentUrl API
PHP version of the Python script located at http://decenturl.com/tools#api. Update: Thanks to a quick update by Ben, DecentURL now returns valid JSON, so the quote workaround is no longer needed. <?php /* PHP interface for the DecentUrl service by Matthew D (project-2501.net) Based on the [...]
5 Things I hate about PHP
Articles on why PHP sucks are fairly common (PHP is a really easy target). So rather than repeat what’s already been said (lack of namespaces, function naming, and arugment positions, etc), I though I’d try and come up some more obscure ‘features’ and ‘bugs’ in PHP that I hate. create_function() // Actually creates a new [...]
Fun with ‘anonymous’ functions in PHP
Just some fun with anonymous functions in PHP (which are surprisingly rare due to silly syntax, and a buggy implementation) <?php class LambdaException extends Exception {} class Lambda { private static $cache; public static function Create($functionString) { [...]
explodeTree
While reading a blog post by Kevin Van Zonneveld’s on converting arrays to trees in PHP, I was shocked to see his approach to the problem. To paraphrase a popular quote: Some people, when confronted with a problem, think“I know, I’ll use eval.” Now they have two problems. Below is the same function, but using [...]
qpsmon v0.1
This is a simple script that will print the average qps (using a specidied peri0d) for one or more MySQL databases. If doesn’t have many practical uses, but it’s fun to watch when running large imports or exports. Screenshot <?php /* qpsmon.php v0.1 This is an (extremely) simple script that will [...]
