note 53598 added to function.sort
| From: | Vennie at osu1 dot php dot net | Date: | Tue, 07 Jun 2005 05:23:39 +0000 |
| Subject: | note 53598 added to function.sort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90035@lists.php.net to get a copy of this message | ||
I needed a function to check user input, them feeding numbers to a form,
which represent an order of tasks.
Maybe one exists, I don't know. If it does, I couldn't find it.
Anyways, this is the simple function I came up with. Feed it an array and it will tell you
wether the array's keys follow up on eachother or not.
<?php
// Check if the array's keys follow up on eachother
function seqArray($aInput){
$bBool = true;
ksort($aInput);
for($i=1; $i<=count($aInput); $i++){
if(!isset($aInput[$i])){
$bBool = false;
}
}
return $bBool;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.sort.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53598
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53598&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53598&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53598&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53598&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53598&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53598&report=yes
Search -- http://master.php.net/manage/user-notes.php