How does the use of JavaScript for loading bars in PHP websites impact user experience and accessibility, considering the possibility of JavaScript being disabled?

When using JavaScript for loading bars in PHP websites, it can enhance user experience by providing visual feedback on the progress of a task. However, if JavaScript is disabled, users may not see the loading bar, which can lead to confusion or frustration. To ensure accessibility, it's important to provide an alternative method for indicating progress that doesn't rely on JavaScript, such as using server-side techniques like PHP to update the loading status.

<?php
// PHP code to simulate a loading bar without relying on JavaScript
$total = 100;
for ($i = 1; $i <= $total; $i++) {
    // Perform tasks here
    // Update loading status
    $percent = intval($i/$total * 100)."%";
    echo '<div style="width: 100%; background-color: #f1f1f1;">';
    echo '<div style="width:'.$percent.'; background-color: #4CAF50;">'.$percent.'</div>';
    echo '</div>';
    // Flush output to show loading bar progress
    ob_flush();
    flush();
    // Simulate delay
    usleep(100000);
}
?>