- mt_rand: documentation ( source)
- range: documentation ( source)
- header: documentation ( source)
<?php
header("Content-type: image/png");
$im = imagecreatetruecolor(512, 512);
$true = imagecolorallocate($im, 255, 255, 255);
foreach (range(0, 512) as $y) {
foreach (range(0, 512) as $x) {
if (mt_rand(0, 1)) {
imagesetpixel($im, $x, $y, $true);
}
}
}
imagepng($im);