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;
    }
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;
    }
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 ; }
Implements the Python slice behaviour

* a[1:2:3] => slice($a, 1, 2, 3)
* a[1:4]   => slice($a, 1, 4)
* a[3::2]  => slice($a, 3, null, 2)

If $byReference is true, then the elements of
the resulting array will be references to the initial
array.

@param array $array array
@param int|null $start start
@param int|null $stop stop
@param int|null $step step
@param bool $byReference byReference

@return void
Implements the Python slice behaviour