In_array - weird behaviour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

The following snippet:

        echo "<select name='inst[]' multiple>";
        foreach ($kategorier as $key => $val) {
                $select = (in_array($key,$institution ))? 'selected':'';
                echo "<option value='$key' $select>".$val[0];
        }
        echo "</select></td></tr>";

Works fine on our testserver, but on our production server all the
options will be selected. 
The setup of both the two servers are php 4.3.0/Windows NT 5.0/IIS 5.0.

The script was completely identical on the two servers.
In both cases the arrays $kategorier and $institution are the same (Yes
I have checked.)
Also the generated $key => $val pairs where identical.
So the problem should be in in_array. I could fix my problem by using
in_array($key,$institution,TRUE ), but does anyone of you have an
explanation for this strange behaviour?

Regards Henrik Hornemann

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux