How can array values be stored in a variable in PHP?

To store array values in a variable in PHP, you can simply assign the array to a variable using the assignment operator. This allows you to access and manipulate the array values using the variable name.

// Storing array values in a variable
$array = [1, 2, 3, 4, 5];

// Accessing array values using the variable
echo $array[0]; // Outputs 1
echo $array[2]; // Outputs 3