[php] Deleting an element from an array in PHP

For those of you who are looking for Ruby's hash#delete equivalent in PHP:

<?php
    function array_delete(&$array, $key) {
        if (!isset($array[$key])) {
            return null;
        }

        $value = $array[$key];
        unset($array[$key]);
        return $value;
    }

This will not only delete the element from your array, but it will also return the value stored in that key so you can consume your array in a non-linear fashion.