How can logging be implemented effectively when checking if a number is even or odd in PHP?

When checking if a number is even or odd in PHP, logging can be implemented effectively by using the error_log() function to log the result. This allows for easy tracking and debugging of the code.

$num = 10;

if($num % 2 == 0){
    error_log($num . " is even");
} else {
    error_log($num . " is odd");
}