What are the differences between multi-dimensional arrays and nested arrays in PHP?

Multi-dimensional arrays in PHP are arrays within arrays, allowing for a higher level of data organization. Nested arrays, on the other hand, are arrays that are embedded within each other. The key difference is that multi-dimensional arrays have a fixed number of dimensions specified when the array is created, while nested arrays can have a varying number of levels depending on the structure of the data.

// Multi-dimensional array
$multiDimArray = array(
    array(1, 2, 3),
    array(4, 5, 6),
    array(7, 8, 9)
);

// Nested array
$nestedArray = array(
    'fruits' => array('apple', 'banana', 'orange'),
    'vegetables' => array('carrot', 'broccoli', 'spinach')
);