What are potential pitfalls of storing PNG images in an array in PHP?

Storing PNG images in an array in PHP can consume a large amount of memory, especially for large images. This can lead to performance issues and potentially cause the script to run out of memory. To solve this issue, it's better to store the file paths or URLs of the images in the array instead of the actual image data.

// Storing file paths of PNG images in an array
$imagePaths = [
    'image1.png',
    'image2.png',
    'image3.png'
];

// Accessing an image path
echo $imagePaths[0];