Login   Register  
PHP Classes
elePHPant
Icontem

Need Help On PHP Code

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP Classes blog  >  Ask difficult questio...  >  All threads  >  Need Help On PHP Code  >  (Un) Subscribe thread alerts  
Subject:Need Help On PHP Code
Summary:PHP array code help
Messages:2
Author:Sam Patnaik
Date:2011-08-02 02:32:30
Update:2011-09-23 19:16:19
 

  1. Need Help On PHP Code   Reply  
Picture of Sam Patnaik
Sam Patnaik
2011-08-02 02:52:00
In a PHP program example, an array called grades is supposed to have been sorted in decreasing order, e.g., [100, 98, 95, ].

How to write a function called function isSorted($grades) to check if the grades array has been sorted correctly. If yes, the function returns true, otherwise returns false.

Your response is appreciated.

Thanks,
Sam.

  2. Re: Need Help On PHP Code   Reply  
Picture of Manuel Lemos
Manuel Lemos
2011-09-23 19:16:19 - In reply to message 1 from Sam Patnaik
You can always traverse the array and verify if each element has a value that is smaller than the previous.