I'm making adaptations in an old system and need to create a new routine to split a two-dimensional array into 2 simple arrays.
Let's say that the variable $query
receives the array below:
$query = array("SELECT * FROM teste WHERE nome in (?) and id in (?)", array('aaa', 1));
My goal is to split this array and cause a $sql
variable to receive:
SELECT * FROM teste WHERE nome in (?) and id in (?)
And another, called $arg
, will receive:
array('aaa', 1)
I've tried doing this division with implode
, but the return was not as expected.
And with explode
always get NULL
.
Is there a native PHP function that makes this division? Or at least some routine that can do this by brute force?
Thank you in advance.