Question

this toI can't get this to work :

foreach($ga->getResults() as $result){ 
$go = $result->getVisitors();  
} 
echo $output = implode(',', $go);

or this :

foreach($ga->getResults() as $result){ 
$go = $result->getVisitors();  
echo $output = implode(',', $go);
} 

I get this error always : Warning: implode() [function.implode]: Invalid arguments

Was it helpful?

Solution

This is wrong

echo $output = implode(',', $go);

This will echo the outcome of the assignment of the =

You should try

echo implode(',', $go);

Or this

$output = implode(',', $go);
echo $output;

Or

var_dump($go);

Edit

$array = array();
foreach($ga->getResults() as $result){ 
    $array[] = $result->getVisitors();  
} 
echo implode($array, ",");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top