In this example we are going to draw a simple Bar graph. Take a school for exmaple. We are going to draw a graph for week days and the total number of student that come to school.

First of all we declare two arrays. The first for the student and the second for week days. Then we calculate the maximal number of student. On the basis of that number we are going to calculate the percentage length of the other bar graphs.

Using the php imagerectangle() function we draw the graph.
We use imagestring() to display our label and message.