View Single Post
Old 03-09-2006, 02:13 PM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,529
sde is on a distinguished road
are you really meaning to search for the iterating number $i ? your code is a little confusing to me. i don't think you have to keep re-declaring global vars inside your for loop.

since i don't understand exactly what your code does, i'll suggest looking at this example from php.net
PHP Code:
<?php
$array 
= array(=> 'blue'=> 'red'=> 'green'=> 'red');

$key array_search('green'$array); // $key = 2;

echo "green key is: " $key "<br>";

$key array_search('red'$array);  // $key = 1;

echo "red key is: " $key "<br>";
?>
try running that to make sure the keys print as you expect.

another thing you might want to try if you haven't already, is dump your array to screen to make sure it contains what you think it contains.

PHP Code:
<?
echo "<pre>";
print_r($modulead);
echo 
"</pre>";
?>
sde is offline   Reply With Quote