$txt1 = "123 456"; $txt2 = "789 101112"; $texto = strlen(str_replace(' ', '', $txt1.$txt2)); echo "Cantidad de caracteres ". $texto;