3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ColorShifter{ private $colors; public function __construct($colors) { $this->colors = new ArrayObject($colors); } public function getNext() { $this->colors->getIterator()->next(); return $this->colors->getIterator()->current(); } } $imageWidth = 300; $imageHeight = 350; $image = imagecreate($imageWidth, $imageHeight); $red = imagecolorallocate($image, 255, 10 , 10); $blue = imagecolorallocate($image, 10, 10 , 255); $gold = imagecolorallocate($image, 255, 240, 0); $colors = new ArrayObject(array($red, $blue, $gold)); $iterator = $colors->getIterator(); for($i = 0; $i<$imageWidth; $i += 10){ if(!$iterator->valid()) $iterator->rewind(); $iterator->next(); imagefilledrectangle($image, 0 , 0, $imageWidth - $i , $imageHeight-$i, $iterator->current()); } $iterator->next(); imagefilledrectangle($image, 0, 0, 10, 10, $iterator->current()); imagepng($image); header('Content-Type: image/png'); echo $image;
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function imagecreate() in /in/5hYuX:21 Stack trace: #0 {main} thrown in /in/5hYuX on line 21
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
51.85 ms | 401 KiB | 8 Q