I’m trying to randomize background pic and generate some text on it.
So here is piece of my code:
$background=$option.".jpg";
$opt="0,1,2,3,4,5,6,7";
$opt=explode(",",$opt);
$option=$opt[rand(0,7)];
and
$im = imagecreatefromjpeg ($background);
Please tell me why I get this error while rand?!?
Pics are numbers 0-7.

You’re getting this error because you are trying to use the $option variable before you have actually set it to what you want it.
Should be:
Also, why bother with the string? Why not use this: