I do a print_r($my_var)
and get a result like:
Array ( [0] => Array ( [email] => [email protected] ) [1] => Array ( [email] => [email protected] ) )
How to get a new array like
$mails= array( '[email protected]','[email protected]' );
I do a print_r($my_var)
and get a result like:
Array ( [0] => Array ( [email] => [email protected] ) [1] => Array ( [email] => [email protected] ) )
How to get a new array like
$mails= array( '[email protected]','[email protected]' );
array_values($myvar[0]);
// Will return the values inside you array ( I noticed your array was nested, so I did the values of he 0 element).
http://www.php.net/manual/en/function.array-values.php
Highly recommend just having a little read of all the available array functions just quickly so you can see what is possible.
foreach ($myvar->result() as $val) $to .= $val->email . ", ";but to get rid ot that last comma?rtrim($to, ', ')