vurentjie Posted May 12, 2008 Share Posted May 12, 2008 hi just a simple question, in php if i create a multidimensional numeric array for example, $array[0][1] = "this"; $array[3][0] = "that"; $array[5][0] = "something"; would the inbetween array elements also be created (ie $array[1],$array[2],$array[4]) as empty array elements? or would it be the same as normal text array like, $array['zero'][1] = "this"; $array['three'][0] = "that"; $array['five'][0] = "something"; where no inbetween array elements are created, ie there is no $array['four'] thanks Link to comment https://forums.phpfreaks.com/topic/105264-php-multi-array/ Share on other sites More sharing options...
nikefido Posted May 12, 2008 Share Posted May 12, 2008 after typing: $array[0][1] = "this"; $array[3][0] = "that"; $array[5][0] = "something"; do a count of your array and find out! echo count($array); //6 means yes, the middle ones are "filled in", 3 would mean they are not Link to comment https://forums.phpfreaks.com/topic/105264-php-multi-array/#findComment-539001 Share on other sites More sharing options...
BlueSkyIS Posted May 12, 2008 Share Posted May 12, 2008 the in-betweens are not created. use count($an_array) to see how many elements are actually in each. Link to comment https://forums.phpfreaks.com/topic/105264-php-multi-array/#findComment-539002 Share on other sites More sharing options...
vurentjie Posted May 12, 2008 Author Share Posted May 12, 2008 ja, should've just checked that, duh, anyhow thanks for advice.... Link to comment https://forums.phpfreaks.com/topic/105264-php-multi-array/#findComment-539008 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.