<?php

function squeezeString($string, $squeezeChar) {
    $previousChar = null;
    $squeeze = '';
    $charArray = preg_split('
    for ($i = 0 ; $i < count($charArray) ; $i++) {
        $currentChar = $charArray[$i];
        if ($previousChar !== $currentChar || $currentChar !== $squeezeChar) {
            $squeeze .= $charArray[$i];
        }
        $previousChar = $currentChar;
    }
    return $squeeze;
}

function isSqueezable($string, $squeezeChar) {
    return ($string !== squeezeString($string, $squeezeChar));
}

$strings = array(
    ['-', ' --- Abraham Lincoln '],
    ['1', '..1111111111111111111111111111111111111111111111111111111111111117777888'],
    ['l', ],
    [' ', '                                                    --- Harry S Truman  '],
    ['9', '0112223333444445555556666666777777778888888889999999999'],
    ['e', ],
    ['k', ],
);
foreach ($strings as $params) {
    list($char, $original) = $params;
    echo 'Original  : <<<', $original, '>>> (len=', mb_strlen($original), ')', PHP_EOL;
    if (isSqueezable($original, $char)) {
        $squeeze = squeezeString($original, $char);
        echo 'Squeeze(', $char, '): <<<', $squeeze, '>>> (len=', mb_strlen($squeeze), ')', PHP_EOL, PHP_EOL;
    } else {
        echo 'Squeeze(', $char, '): string is not squeezable (char=', $char, ')...', PHP_EOL, PHP_EOL;
    }
}