diff --git a/tabs_to_space.php b/tabs_to_space.php new file mode 100644 index 0000000..6d2f4ce --- /dev/null +++ b/tabs_to_space.php @@ -0,0 +1,34 @@ +_connection = $connection; + } +}'; + +$result = ''; +foreach (token_get_all($string) as $token) { + if (is_array($token) && in_array($token[0], [T_ENCAPSED_AND_WHITESPACE, T_CONSTANT_ENCAPSED_STRING])) { + $token[1] = preg_replace('#\s#', '.', $token[1]); + } + $result .= is_array($token) ? $token[1] : $token; +} +$string = $result; + +if((bool) preg_match('~\x{00a0}~siu', $string)) { #remove super stupid space! + $text = preg_replace('~\x{00a0}~siu', ' ', $string); +} +$string = str_replace("\n", PHP_EOL, str_replace(["\r\n", "\r"], "\n", $string)); #newline characters normalizer for the current OS +$new = trim(preg_replace('/\t+/', ' ', $string)); +echo '
'; +var_dump($new);