PHP - Wanted: Improvement in Parsing Lookup Tables

This is something I have unsuccessfully been searching for on and off for the past few years. In my work we get lookup tables…

Here is a general example, given the Family size in columns 3-7 and the monthly income equal to or greater than the amounts in the rows under the family size, you can determine the rate from column 2… Similar to US income tax tables…

Family Size & Income
# RATE 1-2 3 4 5 6
1$1.0010001500162017801900
2$1.5010561560170019002030
3$2.0011201610179020012170

I am looking for is a good way to parse these tables to lookup via text file or DB. The more the input can retain the original format the better. Lookups should be accessed via a PHP function like: $rate = findRate($famsize,$income).

Currently I do it with a MySQL table, and the data does not look anything like the above, and is understandably a pain to make into an entry screen for it - the format is right, but the user can't just copy/paste the text of the table in and have PHP parse in the data - which would be the desired goal. I would really like the data saved more looking like the table above. Anyone have/know any approaches that make the raw data more presentable or the entry much easier?

~~LINKBACK~~ ~~DISCUSSION~~

Last modified:: 2020/11/22 08:55
   
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International