Skip to content
Advertisement

foreach loop populate array for call_user_func_array

I am using a foreach loop to populate an array with parameter types and parameter values before it inserts into the database. Everything works fine and posts to the db, but I can’t figure out why it sends both values as the same when they are added (as a reference) to the array. I have tired calling unset(); but it doesn’t do the trick.

JavaScript

The result ends being:

JavaScript

Advertisement

Answer

You need to remove & from there inside foreach();-

JavaScript

And Add & inside function argument too:-

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement