|
Posted by Kimmo Laine on 02/19/07 10:31
"CoreyWhite" <CoreyWhite@gmail.com> wrote in message
news:1171764363.117909.311890@v45g2000cwv.googlegroups.com...
> This code runs @ http://www.ckoogle.com but the trouble is once I get
> the list backwards, and in an array. I can't sort the new array into
> alphabetical order. Anyone know a way to do it?
Could you explain this with a bit more details. Now this sounds to me like
you either shouldn't reverse it in the first place if you indeed want it
sorted alphabetically or if you want it reversed, then I can't see the
problem, it is in backwards alphabetical order. And furthermore, I don't see
the "new" array anywhere, you opereate only one array, $my_array.
> <?php
>
> echo '<form action="index.php" method="post">';
> echo '<textarea name="input" cols="12" rows="20">';
> echo '</textarea><br>';
> echo '<input type="submit" value="Submit">';
> echo '</form>';
>
> if( isset( $_POST["input"] )){
> $my_array = $_POST["input"];
> $my_array=strrev($my_array);
> $my_array=explode("\n", $my_array);
> print_r($my_array);
> sort($my_array);
> print_r($my_array);
> for($cnt=0; $cnt < count($my_array); $cnt++)
> {
> echo(strrev($my_array[$cnt]));
> echo('<br>');
> }
> }
> ?>
>
Navigation:
[Reply to this message]
|