mkosmosports Posted January 12, 2007 Share Posted January 12, 2007 I have a multidimensional array..$monthss = array("2digit"=>array("01","02","03","04","05","06","07","08","09","10","11","12",),"shorttxt"=>array("Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"), "longtxt"=>array("January","February","March","April","May","June","July","August","September","October","November","December"));Then I run a loop and I want to take out values from that array and place them as a variable. Ive got:$var = $monthss[$2digit($trmon)]; as well as several other varieties...Obviously this is not the way to use the md array.... :P Any help appreciated..Thanks. Quote Link to comment Share on other sites More sharing options...
scotmcc Posted January 12, 2007 Share Posted January 12, 2007 Try this:<?php $a[1][1] = "one one</br>"; $a[1][2] = "one two</br>"; $a[2][1] = "two one</br>"; $a[2][2] = "two two</br>"; echo $a[1][1]; echo $a[2][1];?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 12, 2007 Share Posted January 12, 2007 use [] not () Quote Link to comment Share on other sites More sharing options...
mkosmosports Posted January 12, 2007 Author Share Posted January 12, 2007 Is there a way I can manually assign ID keys in a multidimensional array? Quote Link to comment Share on other sites More sharing options...
scotmcc Posted January 12, 2007 Share Posted January 12, 2007 <?php $months["foo"]["bar"] = "foobar"; echo $months["foo"]["bar"]; ?> Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 12, 2007 Share Posted January 12, 2007 The same way you do for a regular array:[code]$arr = array("one"=> array("smaller"=>1, "bigger"=>2), "two"=>array("etc"=>2));[/code](ps: I didn't test that) Quote Link to comment Share on other sites More sharing options...
mkosmosports Posted January 12, 2007 Author Share Posted January 12, 2007 Thanks scotmcc and Jesirose for your help! Im gonna use that and put together what I want to achieve. Hopefully it'll work. Ill let ya'll know.... 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.