What is the difference between a multidimensional array and a 1-dimensional array in PHP?
A multidimensional array in PHP is an array that contains other arrays as its elements, creating a nested structure. This allows for organizing data in a more complex way, such as creating tables or matrices. On the other hand, a 1-dimensional array in PHP is a simple array that contains a list of values in a linear fashion. The main difference is in the structure and complexity of data representation.
// Example of a multidimensional array
$multidimensionalArray = array(
array(1, 2, 3),
array(4, 5, 6),
array(7, 8, 9)
);
// Example of a 1-dimensional array
$oneDimensionalArray = array(1, 2, 3, 4, 5);