Interference elements (points) in PHP development verification code tutorial
In the previous section, we have finished displaying 4 random numbers in the canvas.
The code is as follows:
Next we will add interference based on the above code. Element
Similarly we use a for loop to add points to add 200 points
for($i=0;$i<200;$i++){
/ /First we set the color of the point
$pointcolor = imagecolorallocate($image,rand(50,200),rand(50,200),rand(50,200));
//Set where the point is placed in the image Up
imagesetpixel($image,rand(1,99),rand(1,29),$pointcolor);
}
Let’s take a look at the complete code: