Store images in array PHP -
i'm new @ php doing work, want save images in php array , show them in screen, cannot save them or display them.
<?php $min = 1; $max = 9; $number1 = rand($min,$max); ($i=1 ; $i<=$number1 ; $i++){ $firstn [$i] = echo "<img src='index.jpg' border='0'>"; } echo $firstn [1]; ?>
this got , , last line test nothing works, google topic doesn't help. in advance.
as long index.jpg
in same directory file, should work:
<?php $firstn = array(); $min = 1; $max = 9; $number1 = rand($min, $max); ($i = 0; $i < $number1; $i++){ $firstn[] = '<img src="index.jpg" border="0">'; } echo $firstn[0]; ?>
cleaned code bit. when storing information in array, don't use echo
and, mister pointed out, had space in echo @ bottom of code between array-variable , brackets.
Comments
Post a Comment