puretony Posted October 3, 2009 Share Posted October 3, 2009 The below information will be saved into a text file named Inwine.txt. Design a php script to read it and output its contents to a file name Output.txt which includes the following: *the average wine list *the cheapest and most expensive wine Wine Producer Wine name Wine price Angove’s LTD Sherry $5.75 Gravida Claret $9.50 Mildara Wines Pty Ltd White Port $8.69 Angove’s LTD Claret $11.30 Penfolds Wine Ltd Riesling $10.45 Best’s Wine Pty Ltd White Burgundy $12.90 Lake’s Folly Chardonnay $15.70 Chateau Yeildara Rose $8.50 Coolabah Lumbrussco $4.90 Barossa Valley Cuvee $6.75 please help me Quote Link to comment https://forums.phpfreaks.com/topic/176340-php-question-help/ Share on other sites More sharing options...
.josh Posted October 3, 2009 Share Posted October 3, 2009 You can use file to retrieve the contents of Inwine.txt. You can loop through each row with foreach, and use explode to separate the values. You can use sort or rsort to sort the array. max and min to find out highest and lowest prices. You can use array_sum and count to find out average price. You can use file_put_contents to put the info in Output.txt Good luck! Quote Link to comment https://forums.phpfreaks.com/topic/176340-php-question-help/#findComment-929440 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.