Answer the question
In order to leave comments, you need to log in
How to write different values in two variables from for in php?
hello
i have this code
$arr = array ('imgk','imgkk');
for ($i=0;$i < count($arr);++$i) {
$x = $arr [$i];
$FileName = $_FILES[$x]['name'];
$TempName = $_FILES[$x]['tmp_name'];
$length = 15;
$chars = 'abdefhiknrstyzABDEFGHKNQRSTYZ23456789';
$numChars = strlen($chars);
$string = '';
for ($ik = 0; $ik < $length; $ik++) {
$string .= substr($chars, rand(1, $numChars) - 1, 1);
}
$final = $string.".png";
$finalTwo = 'img/'.$final;
include_once('classSimpleImage.php');
$image = new SimpleImage();
$image->load($TempName);
$image->resizeToWidth(250);
$image->save($finalTwo);
}
Answer the question
In order to leave comments, you need to log in
just ideas.
What if you just use an array?
$finalTwo = [];
//................. твой код
$finalTwo[] = 'img/'.$final;
$finalTwo = [];
//****************твой код
$finalTwo['adImage'. ($i+1)] = 'img/'.$final;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question