<?php
/**
* Class UsernameGenerator
* @package Gibb\EventoBundle\Generator
*/
class GlobalAcronymGenerator
{
/**
* Ersetzt alle Umlaute
* @param $s string|array
* @return string|array
*/
private static function getGlobalAcronym($string)
{
$s = str_replace(array("Ä", "Ö", "Ü", "ä", "ö", "ü", "ß"), array("Ae", "Oe", "Ue", "ae", "oe", "ue", "ss"), $string);
$r = '';
$s1 = @iconv('UTF-8', 'ASCII//TRANSLIT', $s);
for ($i = 0; $i < strlen($s1); $i++) {
$ch1 = $s1[$i];
$ch2 = mb_substr($s, $i, 1);
$r .= $ch1 == '?' ? $ch2 : $ch1;
}
$r = preg_replace('=\W=is', '_', $r);
return $r;
}
}
var_dump(GlobalAcronymGenerator::getGlobalAcronym('hs def älö ?Wef32'))
- Output for 7.0.0 - 7.0.31, 7.1.0 - 7.1.21, 7.2.0 - 7.2.9
- Parse error: syntax error, unexpected end of file in /in/oNqWu on line 34
Process exited with code 255.
preferences:
172.73 ms | 1399 KiB | 71 Q