Read in the text file
Explode each line of text into 3 different arrays
For example one line of the text file would be 'Name Company Price'
I'd like to store the price into an array as a number but it would store the $ symbol as well
I tried using the str_replace but to no avail.
What my thinking process is to remove the $ symbol before storing it in the array
At the moment the return value is 0
Thanks in advance for any help
Code: Select all
while(!feof($textFile)){
$strRecord = fgets($textFile);
$arField = explode('=', $strRecord);
$arName[$intCounter] = $arField[0];
$arCompany[$intCounter] = $arField[1];
str_replace('$',"",$arField[2]);
$arPrice[$intCounter] = (int)$arField[2];
echo "$arProducer[$intCounter]<br />";
echo "$arName[$intCounter]<br />";
echo "$arPrice[$intCounter]<br />";
$intCounter ++;
}