s there a function in php w/c determines how many dimensions an array contain?
f so,may i know?..^_^
thnx...

Recommended Answers

All 2 Replies

s there a function in php w/c determines how many dimensions an array contain?
f so,may i know?..^_^
thnx...

Heres from http://php.net/array with just the notation modified.

function countdim($array) {
	if (is_array(reset($array))) {
		return countdim(reset($array)) + 1;
	} else {
		return 1;
	}
}

Its a really nice piece of code. ;)

thank you.....ur awesome...^__^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.