<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 6.00.2900.5921" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>jei prasuka 6000, turi ir 12000 prasukt. Gal suki per web'a ir suveikia script time-outas... bandyk per command prompta sukt.</FONT></DIV> <BLOCKQUOTE dir=ltr style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px"> <DIV>"bk" <<A href="mailto:a@a.com">a@a.com</A>> wrote in message <A href="news:hm8urh$to4$1@trimpas.omnitel.net">news:hm8urh$to4$1@trimpas.omnitel.net</A>...</DIV><FONT face=Arial><FONT size=2> <DIV>sveiki, </DIV> <DIV> </DIV> <DIV>padariau savo pirmaja rekursija, kuri formuoja multidimensional masyva.veikti tai lyg viskas veikia, ale pvz 6000 irasu suka ~20 sekundziu, o 12000 - isvis nesulaukiau... </DIV> <DIV>taigi, kas negerai su sia funckija? slieku savo jegomis daugiau nerandu, bo neesu itin geras egzpertas :)</DIV> <DIV> </DIV> <DIV><? </DIV> <DIV>function get_child($data, $pid = null) {<BR> $tree = array();<BR> <BR> foreach( $data as $key => $d ) {<BR> if( $d['parent_id'] == $pid ) {<BR> <BR> $tree[$d['id']] = array<BR> (<BR> 'parent_id' => $d['parent_id']<BR> );<BR> <BR> unset($data[$key]);<BR> <BR> $children = $this->get_child($data, $d['id']);<BR> <BR> if($children) {<BR> <BR> $tree[$d['id']]['children'] = $children;<BR> <BR> }<BR> <BR> }<BR> }<BR> return $tree;<BR> } </DIV> <DIV>?></DIV></BLOCKQUOTE></FONT></FONT></BODY></HTML>