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