Unifix knowledge database - The original one

Dashboard - News - Search - List - About - Admin


Byt værdier om i et array i php

Author:mike - Tue Feb 21 22:51:05 2006

<?

# Array mangeler, copyright (c) 2006 Mikkel C.M.Christensen

function moveup($array,$num)
{
        if ($num == 0)
        {
                print "Cant do that";
                return $array;
        } else
        {
                $temp=$array[$num-1];
                $array[$num-1]=$array[$num];
                $array[$num]=$temp;
                return $array;
        }
}

function movedown($array,$num)
{
        if ($num == sizeof($array)-1)
        {
                print "Cant do that either";
                return $array;
        } else
        {
                $temp=$array[$num+1];
                $array[$num+1]=$array[$num];
                $array[$num]=$temp;
                return $array;
        }
}

?>
Copyright(c) Unifix.org 2002-2011


Dashboard - News - Search - List - About - Admin
 
Powered by Mikjaer Consulting Solutions - Hosted by Specialhosting.dk