SaMay Posted June 26, 2009 Report Share Posted June 26, 2009 Sveiki. Problēma ir tāda ka ir nepieciešams mainīgais iekš mainīgā. apm šādi $kkas[kkas$id] bet tā tās lietas nenotiek. varētu kāds dot padomu? Quote Link to comment Share on other sites More sharing options...
bubu Posted June 26, 2009 Report Share Posted June 26, 2009 Tev nevajag mainīgo iekš mainīgā. Tev vajag masīvu iekš masīva: $kkas = array(); $kkas["cits"] = array(); $kkas["cits"][0] = "nulle"; $kkas["cits"][1] = "viens"; $kkas["cits"][2] = "divi"; $kk = "cits"; $id = 1; echo $kkas[$kk][$id]; // izvadīs "viens" Quote Link to comment Share on other sites More sharing options...
J0ke Posted June 27, 2009 Report Share Posted June 27, 2009 (edited) test.php $mas['bum']='nono'; $mas['bumba']='yesyes'; $test = 'bum' . $_GET['test']; echo $mas[$test]; test.php?test=ba tipo piemēram :D Edited June 27, 2009 by J0ke Quote Link to comment Share on other sites More sharing options...
bubu Posted June 27, 2009 Report Share Posted June 27, 2009 J0ke, tā var gadīties nelabas lietas. Piemēram, ja vienam sākums ir XY, un beigas ZW, bet otram ir sākums XYZ, un beigas W. Tavā $mas masīvā tie norādīs uz vienu un to pašu elementu: $mas['XY' . 'ZW']='nono'; $mas['XYZ' . 'W']='yesyes'; Quote Link to comment Share on other sites More sharing options...
J0ke Posted June 27, 2009 Report Share Posted June 27, 2009 jautājums bij par implementāciju ;) + tas jau ir paša kodera rokās izdomāt kā pareizāk rīkoties 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.