I have a form my company uses to create some files on the fly based on the input. I have a text area$fileString
and they can enter file names followed by a hard return. I take that and create an array, $list
. What i'm trying to do is if they enter in the text area two file names like this:
item1
item2
that it will create an array that contains 6 values, not two, so like this:
$genList = array(item1_f, item1_b, item1_i, item2_f, item2_b, item2_i);
I am getting this error though when I run my code:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 24 bytes) in /home/dcolor/public_html/dev/create.php on line 18
Line 18 is:
array_push($genList, $list[0] . "_f", $list[0] . "_b", $list[0] . "_i");
What am I doing wrong here? Code below
$fileString = $_POST['fileList'];
$unique = $_POST['unique'];
$size = $_POST['size'];
$generateArray = $_POST['generateArray'];
$list = explode("\r\n",$fileString);
if ($generateArray == "yes") {
if ($size == "5x7inimpos") {
$genList = array();
while (!empty($list)) {
array_push($genList, $list[0] . "_f", $list[0] . "_b", $list[0] . "_i");
}
}
print_r($genlist);
}