Force array to be a string [closed]

There are a few ways you can make an integer a string. Here are 2 main ways to make that happen

  1. Type Cast$values_x[] = (string) $series[0]['data'][$i][0]

  2. Double Quote$values_x[] "{$series[0]['data'][$i][0]}"

Also, you might want to check for null first and assign a default

$values_x = !empty($values_x) ? $values_x : array('2010');

If you want to make the whole array a string, use implode

"values" => implode(', ', $values_x)

If you have multiple integers, this will output ‘2010, 2011’. Replace the comma and space with what you want placed between the pieces.

http://php.net/manual/en/function.implode.php