PHP , Text in Zahlen wandeln

Pullmann

Erfahrenes Mitglied
Hallo !

Folgendes Problem ich will einen Text in Zahlen wandeln
wo halt a = 1 , b= 2 , c=3 etc gewandelt werden sollen

Und die ganzen Zahlen sollen zusammen gerechnet werden

Wie mache ich das
 
Hab es schon fertig sorry



PHP:
if($_REQUEST['submit']){

for ($i=0;$i<=20;$i++){
	
	$position = $trans{$i};      
	
		if ($position == "a" || "A"){
		$wandeln += 1*6;		
		}		
		if ($position == "b" || "B"){
		$wandeln += 2*6;		
		}
		if ($position == "c" || "C"){
		$wandeln += 3*6;		
		}
		

                                           ........................

		  
	}
	echo("$wandeln");    

}


else{
echo("
<form action='$PHP_SELF' method='get'>
<input name='trans' type='text'>
<br>
<input name='submit' type='submit' value='Abschicken'>
</form>

");
}
?>
 
Zurück