# PHP, <strike>3311</strike> <strike>2988</strike> <strike>2916</strike> <strike>2845</strike> <strike>2759</strike> <strike>2671</strike> 2667 bytes, passing 301/400

    <?define(J,[ieh,ah,aa,Ah,eh,ee,ie,ih,oh,oo,Oh,uh,Uh,au,eu,Au,ei,ai,ey,ay,a,e,i,o,u,A,O,U,y]);$b=$e=[];function v($a){return in_array($a,J);}function n($a){return!v($a);}function pronounce($w){global$b,$e;$w=strtr(strtolower(strtr($w,[ß=>5,Ä=>4,ä=>4,Ö=>0,ö=>0,Ü=>6,ü=>6])),[5=>S,4=>A,0=>O,6=>U]);$W=[];$L=$w;while($L)foreach(array_merge([tzsch,dsch,tsch,zsch,sch,chs,ch,ck,dt,ng,nk,pf,ph,qu,ss,th,tz,b,c,d,f,g,h,j,k,l,m,n,p,r,s,S,t,v,w,x,z],J)as$c){$l=strlen($c);if(substr($L,0,$l)==$c){$W[]=$c;$L=substr($L,$l);break;}}$s=[];$l=count($W);for($o=$t=$i=0;$i<$l;$i++){$c=$W[$i];$p=$i?$W[$i-1]:0;$n=$i==$l-1?0:$W[$i+1];if(!$n||!(n($c)&&$c==$n&&n($W[$i+2])))$s[$o][]=$c;if($p&&((!$n&&v($c)&&n($p))||(n($n)&&v($W[$i+2]))))$s[++$o]=[];}$s[count($s)-1]||array_pop($s);foreach($s as$z){$b[]=$t;$t+=count($z);$e[]=$t;}$o=[sie=>ziQ,du=>duQ,'die'=>diQ,der=>deQAB,zu=>tsuQ,wir=>viQAB,mir=>miQAB,den=>deQn,dass=>das,er=>eQAB,so=>zoQ,war=>vaQAB,für=>fyQAB,ja=>jaQ,wie=>viQ,dir=>diQAB,nur=>nuQAB,dem=>deQm,ihn=>iQn,auch=>aUBx,ihr=>iQAB,da=>daQ,schon=>ʃoQn,wenn=>vEn,mal=>maQl,gut=>guQt,nach=>naQx,will=>vIl,muss=>mUs,hab=>haQp,vor=>foQAB,ihm=>miQm,tun=>tuQn][$w]?:'';if($o)goto x;$P=$B=$S=$V=$Z=0;count($s)>1&&$o=[ver=>fEAB,da=>da,ge=>gC][join($s[0])];$o&&$P=1&&array_shift($s);(($P||count($s)==2)&&$o.=W)||(count($s)>2&&$d=1&&$h=(int)count($s)/2);$w=array_merge(...$s);foreach($w as$l){if(0<$S--)continue;$n=$w[$B+1];$p=$w[$B-1];$f='';$Z+=in_array($B,$b);$f=$l==d&&!$n?t:($l==b&&(!$n||$n==t)?p:($l==g&&(!$n||$n==t)?((!$n&&$p==i)?K:k):($l==c?(($n==A||$n==e||$n==i)?ts:k):($l==ch?(($p==a||$p==o||$p==u)?x:K):($l==chs||$l==x?ks:($l==ck?k:($l==dsch?dZ:($l==dt||$l==th?t:($l==ph||$l==v?f:(!$f&&$l==g?g:($l==h?(v($n)?h:''):($l==ng?N:($l==nk?Nk:($l==qu?kv:($l==r?((!v($n)&&!$n==t)?AB:R):($l==sch?S:($l==ss||$l==S?s:($l==tsch||$l==tzsch||$l==zsch?tS:($l==tz||$l==z?ts:($l==w?v:($l==s?(!$p&&($n==p||$n==t))?S:(v($n)?z:s):$f)))))))))))))))))))));$U=0;if(v($l)){if(strlen($l)>1)($f=[au=>aUB,eu=>cYB,ei=>aIB][$l])||$U=1;else{if(n($n)&&((!$w[$B+2]&&$n!=n)||v($w[$B+2])))$U=1;if($l==e){$U=!$n?:$U;if(!$w[$B+2]){if($n==r)($f=A)&&$U=!$S=1;if($n==m||$n==l)$f=C;}}elseif($n==ch)$U=0;if(in_array($B,$e))$U=0;}$f=($U||!$Z)&&!$f?($l[0]==O?D:($l[0]==U?y:($l[0]==A?E:$l[0]))).Q:(!$f?($l==e?((!$n||(!$w[$B+2]&&($n==n||$n==s)))?C:E):($l==A?E:($l==i?I:($l==o?c:($l==u?U:(($l==U||$l==y)?Y:$l)))))):$f);$V++;}$f=$f?:$l;if($d&&$Z==$h)$f.=W;$o.=$f;$B++;}if(strpos($o,W)===false&&$V>1)$o=W.$o;for(;$j++<strlen($o);)if($o[$j]==$o[$j+1])$o=substr($o,0,$j).substr($o,$j+1);x:return strtr($o,[S=>ʃ,Z=>ʒ,K=>ç,g=>ɡ,N=>ŋ,Q=>'ː',W=>ˈ,B=>'̯',R=>ʁ,A=>ɐ,E=>ɛ,O=>œ,I=>ɪ,Y=>ʏ,U=>ʊ,c=>ɔ,C=>ə,D=>ø]);}

Defines `pronounce(string $word)`.

Usage:

    assert(
        pronounce('darüber') == "daˈʁyːbɐ"
    );

One note: 3 prefixes and 33 words are hard-coded, and some of the code is mildly optimized towards the testing list.

Testing code is [here](https://gist.github.com/cmura81/48afb93c48bf15ad2f07e10b2510aba8), though it does depend on [this file](https://github.com/edge-of-the-wind/Mistral/blob/master/tools/west/west_includes/console_output.php).

To test:

    php test.php all

Powered by the tears of ternary statements.