- implode: documentation ( source)
- json_encode: documentation ( source)
<?php
$values = array(
array('w' => 100, 'h'=>100),
array('w' => 200, 'h'=>200),
array('w' => 300, 'h'=>300),
);
$new_values = '';
foreach($values as $value) {
$new_values[] = json_encode(array($value['w'], $value['h']));
}
echo implode(',', $new_values); // [100,100],[200,200],[300,300]