Talk:PHP u1v2

From Ilianko
Revision as of 18:49, 8 November 2015 by Anko (talk | contribs) (Created page with "2. <code><pre><?php $files = array(); $dir = opendir('images'); while( $file = readdir($dir)) { if( !is_dir($file)) { $files[] = $file; }...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

2.

<?php
			
			$files = array();
			$dir = opendir('images');
			
			while( $file = readdir($dir))
			{
				if( !is_dir($file))
				{
					$files[] = $file;
				}	
			}
			$filename = $files[rand(0, sizeof($files)-1)];
		?>
		<img src=images/<?php echo $filename; ?> alt="fourth image" title="fourth image" />