The array looks like this:
array(
array(5, true, 'Foo'),
array(8, true, 'Bar'),
array(8, true, 'FooBar'),
)
Can I determine the longest string length of the 3rd column, without having to iterate over the array?
In my example the longest string would be “FooBar” – 6 chars.
If the inner array had only the string element, I could do max(array_map('strlen', $arr)), but it has 3 items…
Add
array_map('array_pop', $arr)to the mix:http://codepad.org/tRzHoy7Z
Gives
8(after I added the twossto check).array_pop()takes the last array element off and returns it, usearray_shift()to get the first.