- print_r: documentation ( source)
- preg_replace: documentation ( source)
<?php
$maches='{Promotional SMS Credits: 0, Transactional SMS Credits: 9973}';
$matches=preg_replace("/(\w+)?/", '"\1":',$matches);
print_r($matches);
echo "\n";
$matches=preg_replace("/(\w*)/", '"\1":',$matches);
print_r($matches);