On Sat, 27 Oct 2001 01:41, Ashley M. Kirchner wrote:
> In a different language I can write something that will return the
> index of $section in the array, then I can use that index value to fetch
> the INT afterwards:
>
>     $array = {{"section1", 1},{"section2",4},{"section3",2}}
>     if (idx = ($section in list_iassoc($array, 1))) => 1 being the
>                                                        first element
>       // idx[1] = "section#"
>       // idx[2] = INT
>       if ($page > 0 && $page =< $array[idx][2])
>
>     etc.

Like this?

#! /usr/local/bin/php -q
<?php
        // Suck 'em in
        
        $site = array (
                "section1" => 007,
                "section2" => 11,
                "section3" => 57.5,
                "section4" => 12,
                "section5" => 0.007,
                "section6" => 15,
                "section7" => 1007,
                "section8" => 11007,
                "section9" => 111007,
                "section10" => 1
        );
        
        // Arbitrary
        $page = 5;
        
        for( $i = 1; $i <= 10; $i++ )
        {
                $section = "section".$i;
        
                if ( $page > 0 && $page <= (int)$site[$section] )
                {
                        print "The value of $section is greater than the value of 
\$page\n";
                }
                else
                {
                        print "The value of $section is less than the value of 
\$page\n";
                }
        }
        
?>

Cheers,
BAD

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to