Neo Posted April 17, 2014 Share Posted April 17, 2014 Hi I have been reading through the php section about arrays and even though I think it is very informative as it is, I think the section misses an example of how to assign a different variable for each of the items in the array. I'll use the array example with the cars: $cars = array("Volvo","BMW","Toyota"); This will yield: Array ([0] => Volvo [1] => BMW [2] => Toyota) Now what if the user wishes to split the array and assign a variable for each of the items in the array like for example: Volvo = $Sweden BMW = $Germany Toyota = $Japan I think an example of how this is done would be really helpful for some (including myself !). Link to comment Share on other sites More sharing options...
thescientist Posted April 17, 2014 Share Posted April 17, 2014 I'm not sure what you're asking. Making a more complicated array structure is typically application specific. You can always make an array index an array itself to create a multidimensional array, if that's what you're getting at. $cars = array( "volvo" => array( "country" => "Sweden" )); echo $cars["volvo"]["country"]; Link to comment Share on other sites More sharing options...
birbal Posted April 26, 2014 Share Posted April 26, 2014 (edited) I believe he meant t http://php.net/list Edited April 26, 2014 by birbal Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now