hi all,
i have been trying to get my array checked for existing values with isset function:
function myfunc (..., $x, $main_table, $test,....)
{
do {$x++;} while (!isset($main_table[$test[$x]]));
}
$main_table, $test, - arrays that are being passed as function parameters
$x - is a number (start index) that's also being passed as function parameter
PROBLEM: {$x++;} is not being executed cause (!isset($main_table[$test[$x]])) is being skiped or so... :/
any ideas how to fix it or get it work?
p.s. i have tried - do {$x++;} while (!array_key_exists($test[$x],$main_table)); - and still no luck
checking sophisticated - nested arrays with isset()
Moderator: General Moderators
- CoderGoblin
- DevNet Resident
- Posts: 1425
- Joined: Tue Mar 16, 2004 10:03 am
- Location: Aachen, Germany
Have you tried looking into the foreach structure. ? You can nest foreach's into several levels. You have the ability to use foreach ($array as $key=>$value), they are (normally) easily readable etc. All in all I prefer to use them whenever I handle arrays.
Code: Select all
$array['key']=null;
isset($array['key']);
//returns false