I have controller that takes post parameters from HTML form, it will then send them to model that will insert the array into Cassandra database.
It is SQLInjection proof
Its worth remembering that while array_intersect
and array_intersect_key
are good they might well be overkill. In my situation I only wanted 1 element left, therefore the simplest option was just to rebuild the array I wanted based on the key/values I needed. I wonder at what point therefore the array_intersect's don't become worth it and you are simply better off with $new = array('whatI'=>'want');
. I believe in the OP this is worth it but in smaller cases it might be overkill.
Alternatively in response to the original question simply using unset
might have been a cheaper option - unset($post['one'],$post['two'],$post['three'])
. Again though, it relates to the point at which this becomes too inefficient and the array_intersect functions are better.