What is the potential issue with calling a function multiple times in PHP, especially when dealing with MySQL result sets?

Calling a function multiple times in PHP, especially when dealing with MySQL result sets, can lead to performance issues as the function is executed repeatedly. To solve this problem, you can store the result of the function in a variable and reuse that variable instead of calling the function multiple times.

// Store the result of the function in a variable
$result = someFunction();

// Reuse the variable instead of calling the function again
echo $result;