Faks Posted September 1, 2010 Report Share Posted September 1, 2010 Sveiki Damas un Kungi Problema ir sekojosa veicot funkcija darbiba ar assocativo masisvu vins man izvada ara tikai vienu assocativo masivu nevisu visus ara tapec atkal esu seit ceru ka jus varesiet man palidzesiet atrast gaismu bezgaligaja bedre ! function xy($x) { $g = array('1' => 'Viens', '2' => 'Divi', '3' => 'Tris'); foreach($g as $t => $b) { return $t.' -- '.$b.'<br>'; } return $x; } #print_r($x); echo xy($x); Quote Link to comment Share on other sites More sharing options...
marrtins Posted September 1, 2010 Report Share Posted September 1, 2010 Kur tad ir tie pārējie masīvi? Quote Link to comment Share on other sites More sharing options...
Kaklz Posted September 1, 2010 Report Share Posted September 1, 2010 return komanda atgriež funkcijas vērtību, pārtraucot tālāku funkcijas izpildi. Rezultāts ko tu saņem ir tieši tāds, kādu tu prasi PHP. function xy($x){ $text = ''; foreach($x as $t => $b){ $text .= $t . ' -- '.$b.'<br>'; } return $text; } $x = array('1' => 'Viens', '2' => 'Divi', '3' => 'Tris'); echo xy($x); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.