For the verification code, the code below generates a 5-digit number. I want it to be 4 digits. what should I do.
// generate random numbers $sayilar = ''; for ($x = 15; $x <= 95; $x += 20) { $sayilar .= ($sayi = rand(0, 9)); imagechar($image, rand(3, 5), $x, rand(2, 14), $sayi, $textcolor); }
Your loop definition is complex because you loaded a lot of unnecessary logic into it. Modification/maintenance will be clearer and easier: