1--TEST-- 2Test imagecolorclosesthwb() basic functionality 3--SKIPIF-- 4<?php 5 if (!extension_loaded('gd')) { 6 die("skip gd extension not available."); 7 } 8?> 9--FILE-- 10<?php 11 // Create the size of image or blank image 12 $image = imagecreate(500, 200); 13 14 // Set the background color of image 15 $background_color = imagecolorallocate($image, 0, 24, 200); 16 17 // Set the text color of image 18 $text_color = imagecolorallocate($image, 255, 255, 255); 19 20 // Function to create image which contains string. 21 imagestring($image, 5, 180, 100, "PHP is awesome", $text_color); 22 imagestring($image, 3, 120, 120, "A test for PHP imagecolorclosesthwb function", $text_color); 23 24 var_dump(imagecolorclosesthwb($image, 0, 115, 152)); // 0 25 var_dump(imagecolorclosesthwb($image, 0, 24, 200)); // 0 26 var_dump(imagecolorclosesthwb($image, 116, 120, 115)); // 1 27 var_dump(imagecolorclosesthwb($image, 50, 0, 90)); // 0 28 29 imagedestroy($image); 30?> 31--EXPECT-- 32int(0) 33int(0) 34int(1) 35int(0) 36