|
Posted by pauld on 10/22/24 11:34
thanks -great help. Got the first one working not sure i quite
understand it though (!)
the added problem is that I have a series of these and would ideally
like to to generate the array name dynamically.The array_push is an
attempt to make the code generic
eg for 2 of them I can do
if ($key=="oxy") {
foreach($oxysorted as $v)
{array_push($sorted,$v);}
$oxord = array_flip($sorted);
uksort($val, 'keysort');
print '<table summary="" border=2>';
foreach($val as $i=>$v){print '<tr><td>'.$i."=>".$v.'</td></tr>';
}
}
else if ($key=="physio") {
foreach($physiosorted as $v){array_push($sorted,$v);}
$oxord = array_flip($sorted);
uksort($val, 'keysort');
print '<table summary="" border=2>';
foreach($val as $i=>$v){print '<tr><td>'.$i."=>".$v.'</td></tr>';
}
}
Ive tried genertign the array name dynamically but it doesnt revognise
it as an array
eg
$varsorted=$key.'sorted';
and replacing the ($oxysorted as $v) and ($physiosorted as $v) with
($varsorted as $v) but it doenst like it .
I *think* its the php equivalent of perls $$variable that Im after
Navigation:
[Reply to this message]
|