Page 1 sur 1

string to braille

Posté : 01 juil. 2014, 16:07
par telnes
hello

petit code pour transformer une chaine de texte en braille :)
<?php
//http://ophtasurf.free.fr/lebraille.htm
//compléter l'alphabet
$alpha = array(
	'a'=>'&#10241;',
	'b'=>'&#10243;',
	'c'=>'&#10249;',
	'd'=>'&#10265;',
	'e'=>'&#10257;',
	'f'=>'&#10251;',
	'g'=>'&#10267;',
	'h'=>'&#10259;',
	'i'=>'&#10250;',
	'j'=>'&#10266;',
	'k'=>'&#10245;',
	'l'=>'&#10247;',
	'm'=>'&#10253;',
	'n'=>'&#10269;',
	'o'=>'&#10261;',
	'p'=>'&#10255;',
	'q'=>'&#10271;',
	'r'=>'&#10263;',
	's'=>'&#10254;',
	't'=>'&#10270;',
	'u'=>'&#10277;',
	'v'=>'&#10279;',
	'w'=>'&#10298;',
	'x'=>'&#10285;',
	'y'=>'&#10301;',
	'z'=>'&#10293;',
	'0'=>'',
	'1'=>'',
	'2'=>'',
	'3'=>'',
	'4'=>'',
	'5'=>'',
	'6'=>'',
	'7'=>'',
	'8'=>'',
	'9'=>'',
	' '=>'&#10240;',
	'.'=>'&#10290;',
	':'=>'&#10258;',
	'/'=>'&#;',
	''=>'&#;',
	''=>'&#;',
	);
	
	$txt = (isset($_GET['a']))?$_GET['a']:'mon texte a convertir';
	
	$tmp = str_split($txt);
	$res = '';
	foreach($tmp as $value){
	
		$res .= $alpha[$value];
	}
	
	echo "<h1>$res</h1>";
	echo $txt;	
?>
Image

Re: string to braille

Posté : 24 sept. 2014, 15:39
par wolflarsen
Yep sympa !
Cela dit, je me dis que la phase suivante c'est plutôt l'interfaçage avec une machine braille, parce que là... :wink: