Hey guys.
I have a function that is returning options that the user has selected.
I need to get these options in an array for matching.
Here is my rough code.
$test = array();
$newVals = (printList($file_names));
$newArray = array_fill_keys($test, $newVals);
if (in_array("this.pdf", $test, TRUE))
{
echo "Match found<br>";
}
else
{
echo "Match not found<br>";
}
The funtion that spits out user selections is this
function printList($file_names){
//print the list
echo "<p class=cart-list-header ></p>";
echo "<ul class=cart-list>";
$pdf_check = glob('pdf/*.pdf');
$tpdf = array();
foreach($pdf_check as $pdf){
$tpdf[] = substr($pdf, 4);
}
foreach($file_names as $file){
if (in_array($file, $tpdf)){
echo "'$file',";
}else{
echo "<li>$file <span class='red_txt'>(no pdf aviliable)</span></li>";
}
}
echo "</ul>";
}
It generates a great list but I cannot seem to get it into the array correctly.
Any ideas?