So I searched around, but I couldn't find a good answer to my question, so here goes. I'm pulling some data through json, which gets updated every hour.
I want to take this data and save it to my database and categorize the data as "new", "active" & "old"
I have saved a json feed in my database that looks like this when I pull it from the database:
Array (
[0] => Array ( [0] => Blood [1] => all [2] => 2040154277 [3] => 74708 [4] => a )
[1] => Array ( [0] => Blood [1] => all [2] => 2040088680 [3] => 42973 [4] => b )
[2] => Array ( [0] => Blood [1] => all [2] => 2038497801 [3] => 21308 [4] => c )
[3] => Array ( [0] => Blood [1] => all [2] => 2040404080 [3] => 82800 [4] => d )
[4] => Array ( [0] => Blood [1] => all [2] => 2039988402 [3] => 74703 [4] => e )
[5] => Array ( [0] => Blood [1] => all [2] => 2038753364 [3] => 82800 [4] => f )
[6] => Array ( [0] => Blood [1] => all [2] => 2040065624 [3] => 54443 [4] => g )
[7] => Array ( [0] => Blood [1] => all [2] => 2040153539 [3] => 82800 [4] => h )
)
I have made it a little bit more readable by adding letters to [4], but the only unique identifier is the number in [2].
Anyway, this data reflects what data was current 1h ago, so when the new feed comes in:
Array (
[0] => Array ( [0] => Blood [1] => all [2] => 2040123457 [3] => 74708 [4] => aa )
[0] => Array ( [0] => Blood [1] => all [2] => 2040154277 [3] => 74708 [4] => a )
[1] => Array ( [0] => Blood [1] => all [2] => 2040088680 [3] => 42973 [4] => b )
[3] => Array ( [0] => Blood [1] => all [2] => 2040404080 [3] => 82800 [4] => d )
[4] => Array ( [0] => Blood [1] => all [2] => 2039988402 [3] => 74703 [4] => e )
[5] => Array ( [0] => Blood [1] => all [2] => 2038753364 [3] => 82800 [4] => f )
)
We notice that [4] c, g & h have expired, but also that [4] aa is new.
Using the old & new array, how can I identify which ones are new, active & old for a simple insert/update in my sql in a fairly efficient way as the multidimensional array can very well contain 50-60k arrays.
Is there a good way to solve this?