Are there any best practices for handling content changes in multiple frames in PHP?

When dealing with content changes in multiple frames in PHP, it is best practice to use a centralized function to handle the changes. This function should take in the content to be updated as a parameter and then update all the frames accordingly. By centralizing the logic for content changes, it becomes easier to maintain and update the code in the future.

function updateFramesContent($content) {
    // Update content in frame 1
    echo "<script>document.getElementById('frame1').innerHTML = '$content';</script>";
    
    // Update content in frame 2
    echo "<script>document.getElementById('frame2').innerHTML = '$content';</script>";
    
    // Update content in frame 3
    echo "<script>document.getElementById('frame3').innerHTML = '$content';</script>";
}

// Call the function with the new content
updateFramesContent("New content to be displayed");