3v4l.org

run code in 300+ PHP versions simultaneously
<?php $w=150; $h=150; $cols=4; $im = imageCreate($w,$h); $del=1.5; $mw = $w/$del; $mh = $h/$del; $c = imageColorAllocate($im, 245, 245, 245); imagefilledrectangle($im, 0, 0, $w, $h, $c); $c = array(rand(0,200),rand(0,200),rand(0,200)); for($zz=0;$zz<5;$zz++) { $im = createPolgon($im, $w, $h, $mw, $mh,5, $c, 75); } header('Content-type: image/jpg'); imagepng($im); imagedestroy($im); function createPolgon($image, $width, $height, $mwidth, $mheight, $count, $color, $merge) { $img = imageCreate($width,$height); $c = imageColorAllocate($img, 245, 245, 245); imagefilledrectangle($img, 0, 0, $width, $height, $c); for($i=0;$i<$count;$i++) { $c = imageColorAllocate($image,$color[0],$color[1],$color[2]); $cnt=3; $values=array(rand(0,$mwidth), rand(0,$mheight),rand(0,$mwidth), rand(0,$mheight),rand(0,$mwidth), rand(0,$mheight)); imagefilledpolygon($image, $values, $cnt, $c); } $rotate = imagerotate($image, 90, 0); imagecopymerge($image, $rotate, 0, 0, 0, 0, $width, $height, 50); $rotate = imagerotate($image, 180, 0); imagecopymerge($image, $rotate, 0, 0, 0, 0, $width, $height, 50); imagecopymerge($img, $image, 0, 0, 0, 0, $width, $height, $merge); return $img; }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
Fatal error: Uncaught Error: Call to undefined function imageCreate() in /in/qTHAh:8 Stack trace: #0 {main} thrown in /in/qTHAh on line 8
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.36, 5.6.0 - 5.6.28
Fatal error: Call to undefined function imageCreate() in /in/qTHAh on line 8
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: imagecreate() in /in/qTHAh on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: imagecreate() in /in/qTHAh on line 8
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: imagecreate() in /in/qTHAh on line 8

preferences:
212.87 ms | 401 KiB | 253 Q