You are here: Re: print order of assoctive array « PHP Programming Language « IT news, forums, messages
Re: print order of assoctive array

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация