How can one output specific elements from an array generated by explode() in PHP?

When using the explode() function in PHP to split a string into an array, you may want to output specific elements from the generated array. To do this, you can access individual elements by their index in the array. Simply specify the index of the element you want to output within square brackets after the array variable name.

$string = "apple,banana,orange";
$fruits = explode(",", $string);

// Output specific elements from the array
echo $fruits[0]; // Output: apple
echo $fruits[1]; // Output: banana
echo $fruits[2]; // Output: orange