este es el codigo que tengo hasta ahora
Código PHP:
$word1 = "casa";
$word2 = "ferrocarril";
$word3 = "xilofon";
//function
function wordSort($word1, $word2, $word3){
if ($word1 > $word2 && $word1 > $word3) {
if ($word2 > $word3) {
$result = "$word1 $word2 $word3";
} elseif ($word3 > $word2) {
$result = "$word1, $word2, $word3";
}
elseif ($word2 > $word1 && $word2 > $word3) {
if ($word1 > $word3) {
$result = "$word2, $word1, $word3";
} elseif ($word3 > $word1) {
$result = "$word2, $word3, $word1";
}
} elseif ($word3 > $word1 && $word3 > $word2) {
if ($word1 > $word2) {
$result = "$word3, $word1, $word2";
} elseif ($word2 > $word1) {
$result = "$word3, $word2, $word1";
}
}
}
return $result;
}
echo "Ordenadas alfabeticamente:".wordSort();
?>
desde ya agradecere cualquier comentario o ayuda que puedan brindarme...