3v4l.org

run code in 300+ PHP versions simultaneously
<?php function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } mt_srand(make_seed()); $size=512; $image = imagecreatetruecolor($size,$size); $black = imagecolorallocate ($image, 0,0,0 ); $white = imagecolorallocate ($image, 255,255,255 ); for ($x = 0; $x<$size; $x++) { for ($y = 0; $y<$size; $y++) { imagesetpixel($image,$x,$y,mt_rand(0,1)?$black:$white); } } header ('Content-Type: image/png'); imagepng($image); ?>
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.13, 7.3.0
Fatal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in /in/vdasr:8 Stack trace: #0 {main} thrown in /in/vdasr on line 8
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Fatal error: Call to undefined function imagecreatetruecolor() in /in/vdasr on line 8
Process exited with code 255.

preferences:
154.01 ms | 402 KiB | 204 Q