MDL-40266 improve emulate_bound_params() for mysqli
MDL-40266 improve emulate_bound_params() for mysqli

Looping over large numbers of items with array_shift() is expensive.
Reverse the array and fetch items from the top of the pile.

dilawar/moodle