How can PHP developers adhere to the EVA principle and ensure that functions return values instead of directly outputting content?

To adhere to the EVA principle and ensure that functions return values instead of directly outputting content, PHP developers can modify their functions to return values instead of using echo or print statements within the function. By returning values, the function can be used in different contexts and the output can be controlled by the caller rather than being directly outputted.

function calculateSum($num1, $num2) {
    return $num1 + $num2;
}

$sum = calculateSum(5, 3);
echo $sum; // Output: 8