@HamZa - also, I only sort where it's necessary. Faster to inject and sort, than to run through the whole loop with a math compare -- I don't know why.... but the second part to that, is using the C based loops (aka, array_search), doesn't eat up 100% of a cpu core during the cycles.
@HamZa - If you notice, I have a couple more methods that are loops posted underneath. Am able to rescue some time by exiting on found, however sorting is what really hurts --- I really don't like having to copy the keys, but it actually does seem to be much faster than the loop methods below
php.net ... never have I been disrespected so much. and this site allows Lurkers to bash with down-votes... makes it difficult for those (like myself) whose old account was so old, it was gone.
in past years, it has been going downhill. the account deletion is more of a privacy thing. I don't get anywhere near out of this what I put in --- unlike other sites like PlanetSourceCode / etc
@Achrome - love the quote on bash.org ... that does seem to be the common mentality. Problem with regex, is php will execute code in preg_match statements.
filter_input + conditioned variables + validation + prepared statements == sanitization !! .... the one example up-voted almost 2500 times, only uses PDO .... it does not account for the fact that the variable may contain executable code.
not ONE answer combines all the techniques required for true sanitization of variables to prevent SQL Injection ---- no wonder so many sites get hacked
for the record --- i don't generally downvote as I feel that system is not balanced. (aka, person downvoting loses only 1 rep, while the person who posted loses 2 rep )