<?php

$old_v = "aaaggggoooaooogg";
echo preg_replace("/(.)\\1+/", "$1", $old_v);