Location: PHPKode > scripts > Create Gradient > create-gradient/example.php
<h2>Gradient Class Example</h2>
Author: Michael Feinbier &lt;hide@address.com&gt;<p>
<?php
/* GRADIENT CLASS EXAMPLE */
require "class.gradient.php";

$fade_from = "#FF0000"; // HEX-Color to fade from
$fade_to = "#0000FF";   // HEX-Color to fade to
$steps = 15;						// number of steps creating the gradient

$gradient = new gradient($fade_from,$fade_to,$steps); 		// define the class

echo "Gradient from <b>".$gradient->color1."</b> to <b>".$gradient->color2."</b></p><pre>";

print_r($gradient->createArray()); 												// outputs the array to see the values

echo "</pre><table width='300' border='0'>";							// creates the table with colors 
  foreach($gradient->createArray() AS $color){
  	echo "<tr><td bgcolor=$color>&nbsp;</td><td>$color</td></tr>";
    };
  echo "</table>";
?>
Return current item: Create Gradient