depth() public static method

Counts the dimensions of an array. If $all is set to false (which is the default) it will only consider the dimension of the first element in the array.
public static depth ( array $data, array $options = [] ) : integer
$data array Array to count dimensions on.
$options array
return integer The number of dimensions in `$array`.
 public function testDepthFiveLevelsWithAll()
 {
     $data = array('1' => array('1.1' => '1.1.1'), array('2' => array('2.1' => array('2.1.1' => array('2.1.1.1')))), '3' => array('3.1' => array('3.1.1' => '3.1.1.1')));
     $result = Set::depth($data, array('all' => true));
     $this->assertEqual(5, $result);
     $data = array('1' => array('1.1' => '1.1.1'), array('2' => array('2.1' => array('2.1.1' => array('2.1.1.1' => '2.1.1.1.1')))), '3' => array('3.1' => array('3.1.1' => '3.1.1.1')));
     $result = Set::depth($data, array('all' => true));
     $this->assertEqual(5, $result);
 }