1--TEST-- 2Test imagecolorallocate() function : basic functionality 3--SKIPIF-- 4<?php 5if(!extension_loaded('gd')) { 6 die('skip gd extension is not loaded'); 7} 8if(!function_exists('imagecreatetruecolor')) { 9 die('skip imagecreatetruecolor function is not available'); 10} 11?> 12--FILE-- 13<?php 14/* Prototype : int imagecolorallocate(resource im, int red, int green, int blue) 15 * Description: Allocate a color for an image 16 * Source code: ext/gd/gd.c 17 */ 18 19echo "*** Testing imagecolorallocate() : basic functionality ***\n"; 20 21$im = imagecreatetruecolor(200, 200); 22// Calling imagecolorallocate() with all possible arguments 23var_dump( imagecolorallocate($im, 255, 0, 0) ); 24var_dump( imagecolorallocate($im, 0, 255, 0) ); 25var_dump( imagecolorallocate($im, 0, 0, 255) ); 26var_dump( imagecolorallocate($im, 255, 255, 255) ); 27?> 28===DONE=== 29--EXPECT-- 30*** Testing imagecolorallocate() : basic functionality *** 31int(16711680) 32int(65280) 33int(255) 34int(16777215) 35===DONE=== 36