Hi all,

I know this sounds easy but I can't seem to be able to get the value in an array. The result is the array that I got

$result=
Array (
=> [1] => [2] => [3] => Array ( [contact] => {{1}} [contact-ATTR] => Array (
=> Array ( [name] => rose => [email]rose@gmail.com ) [1] => Array ( [name] => Sylph => [email]sylph@gmail.com ) ) ) )

$result = array();
foreach ($result as $contact) {
$result[] = array('name' => (string) $contact['name'], 'email' => (string) $contact['email']);
}
return $result;

However, I get the error "Invalid argument supplied for foreach() " .
Anyone can help me here? Thanks in advance

    $result is not a valid array.

      I also notice that you appear to be trying to set $result to an empty array before looping over $result.

      The actual code would be better than a sketch.

        Write a Reply...