All pastes #2079153 Raw Edit

Stuff

public php v1 · immutable
#2079153 ·published 2011-08-30 20:34 UTC
rendered paste body
<?php/*    liest den ordner $verzeichnis ein, erstellt ein array der dateinamen   und wählt $menge daraus aus - ohne doppelte. genial wah.*/	$verzeichnis = "bilder_rotation";	$menge = 3;	if ( is_dir ( $verzeichnis )) {		if ( $handle = opendir($verzeichnis) ) {			while (($file = readdir($handle)) !== false) {				if( $file == '.' || $file == '..' ) {					continue;				}				$bilder[] = $file;			}			closedir($handle);		}	}	$anzahl = count($bilder);	$i=0;	while ($i < $menge) {		$zahl = rand (0, $anzahl-1);		if ($bilder[$zahl] == -1 ) {			continue;		}		else {			$rotation[$i] = $bilder[$zahl];			$bilder[$zahl] = -1;			$i++;		}							}	?>