表格查找PHP中的数字数据

I have a fairly large table (~5 MB csv file) stored on our server that consists of purely numeric data giving some result based on two parameters, e.g.

A     B     Output
-----------------------
1     1     20
1     2     21
1     3     22
2     1     23
2     2     24
2     3     25
...   ...   ...

What I'd like to do is, based on the user's input, find the closest parameters then use the appropriate output. For example, using the table above, if the user select A=1.1 and B=2.9, the Output would be 22.

What is the best way to do this table lookup in php? Do I need to load the entire table into PHP? Instead of a csv-file, should I make it binary so that the file size is smaller and loads faster? Or should I create a mySQL database and perform a look-up that way?

TL;DR: I'm looking for the most efficient way to perform a nearest-neighbor table look-up on strictly numeric data.

If mysql is available, my suggestion would be to use a table and do a look up. I guess rounding the user input to the nearest integer before lookup should give you the closest.