What is the role of cron jobs in executing PHP scripts for automated tasks?

Cron jobs are used to schedule and automate repetitive tasks on a server, including executing PHP scripts at specific intervals. By setting up a cron job to run a PHP script, you can automate tasks such as sending emails, updating databases, or generating reports without manual intervention.

// Example PHP script to be executed by a cron job
<?php
// Your PHP script code here
echo "This script was executed by a cron job";
?>