Dynamic PHP Array used in sendmany bitcoin command issue I have following problem with dynamic array be used in sendmany transaction in bitcoin engine, problem described in code comments.

step 1 create array
step 2 inserting values to array
step 3 print an array to check the result which is correct
step 4 sendmany (here is a problem) see below

&lt;?php
//step 1 create array
$to = array();
//step 2 inserting values to array
while ( $row_users = mysqli_fetch_array($getting_allowed_users) )
{
          $to[] = array($row_users['user_bitcoin_wallet'] =&gt; $currency);
}

//step 3 print an array to check the result which is correct
print_r(array_values($to)); 

//step 4 sendmany (here is a problem)

// if I do it that way sendmany is only sending to first wallet which is indexed [0]
// I cannot to foreach as php  code structure is not allowing {} inside the command
$bitcoin-&gt;sendmany($BuyerAccount,$to[0]); 

//Question: How I can display all the values from my array in following place
$bitcoin-&gt;sendmany($BuyerAccount,ALL THE VALUES); 

//example
$bitcoin-&gt;sendmany($BuyerAccount,"walet1"=&gt;0.1,"walet2"=&gt;0.1,"walet3"=&gt;0.1.....);
?&gt;
Have you tried:
$bitcoin -&gt; sendmany($BuyerAccount, $to);?
Bitcoin API states &lt;fromaccount&gt; {address:amount,...} [minconf=1] [comment] as parameters, so you don't have to iterate - pass the whole array.
If it doesn't work somehow, you can also prepare request by yourself for RPCClient. This is example for sendfrom:
                $request = '{"method":"sendfrom","params":["'.$params[0].'","'.$params[1].'",'.$params[2].','.$params[3].'],"id":'.$currentId.'}';