public static function slice(&$array, $start = null, $stop = null, $step = null, $byReference = false)
    {
        $result = array();
        $indexes = self::sliceIndices(count($array), $start, $stop, $step);
        if ($byReference) {
            foreach ($indexes as $i) {
                $result[] = &$array[$i];
            }
        } else {
            foreach ($indexes as $i) {
                $result[] = $array[$i];
            }
        }
        return $result;
    }