In_array - weird behaviour

From: Date: Thu, 11 Dec 2003 13:06:50 +0000
Subject: In_array - weird behaviour
Groups: php.windows 
Request: Send a blank email to php-windows+get-22363@lists.php.net to get a copy of this message
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

« previous php.windows (#22363) next »