10023
asked on
Php parsing csv text file with line ending "\n" to multidemensional array
I write to file this way:
$var = "$date, $firstname,$lastname, $address, $city, $state, $zip, $product,$price\n";
File looks like below after write without star break
************************** ********** *
date, firstname, lastname, address, city, state, zip, product, price
date, firstname, lastname, address, city, state, zip, product, price
date, firstname, lastname, address, city, state, zip, product, price
date, firstname, lastname, address, city, state, zip, product, price
************************** ********** *
I need load each line into a $multidemensional[ ] [ ] array so that i can do this
Get lastname by $multidemensional[$i][2] to sort by last name.
I have tried different functions without success to write out multidemensional array...i dont get an error...just no output.
here is my code to test
echo $multidemensional[1][2]."< br/>"; which does not output second row lastname.
i need the array load to multidemension function and most efficient way to sort it..by last name
thanks
I am using php 5.3 and above
$var = "$date, $firstname,$lastname, $address, $city, $state, $zip, $product,$price\n";
File looks like below after write without star break
**************************
date, firstname, lastname, address, city, state, zip, product, price
date, firstname, lastname, address, city, state, zip, product, price
date, firstname, lastname, address, city, state, zip, product, price
date, firstname, lastname, address, city, state, zip, product, price
**************************
I need load each line into a $multidemensional[ ] [ ] array so that i can do this
Get lastname by $multidemensional[$i][2] to sort by last name.
I have tried different functions without success to write out multidemensional array...i dont get an error...just no output.
here is my code to test
echo $multidemensional[1][2]."<
i need the array load to multidemension function and most efficient way to sort it..by last name
thanks
I am using php 5.3 and above
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thankyou very much...
ASKER
print_r so output would be cleaner...trying for loop