Im using a charts plugin an i need to force some array elements to be strings.
$values_x = array();
for ($i = 0; $i < count( $series[0]['data'] ); $i++ ) {
$values_x[] = $series[0]['data'][$i][0];
}
$values_y = array();
for ($i = 0; $i < count( $series[0]['data'] ); $i++ ) {
$values_y[] = $series[0]['data'][$i][1];
}
$categories = array(
"label" => $label_x,
"values" => $values_x,
"colors" => $eco_chart_colors,
);
$series = array("label" => null, "values" => array( array("data" => $values_y)));
} else {
$categories = array(
"label" => $label_x,
"values" => $values_x,
"colors" => "",
);
$series = array("label" => $label_y, "values" => $series);
}
i need $values_x to become strings. it outputs the years in the graph but in the json it comes as integers and i need it to be strings. eg: not 2010 but '2010'. ive tried with strval and some other options but cant seem to get it right, it outputs "values":null when i try it. can someone help? thanks in advance.