コード例 #1
0
ファイル: AlphabetSoup.php プロジェクト: IharPanf/simple_php
<?php

/*
	Using PHP, have the function AlphabetSoup(str) take the str string parameter being passed
	and return the string with the letters in alphabetical order (ie. hello becomes ehllo). 
	Assume numbers and punctuation symbols will not be included in the string. 
*/
function AlphabetSoup($str)
{
    $returnStr = str_split($str);
    sort($returnStr);
    $returnStr = implode('', $returnStr);
    return $returnStr;
}
//Test
echo AlphabetSoup('hello');
コード例 #2
0
<?php

function AlphabetSoup($str)
{
    $str = "Hello World";
    $string = split($str);
    $sortit = sort($str);
    $back = join($str);
}
AlphabetSoup();