How can the functionality to display the "logged in" message be efficiently implemented across multiple pages in a PHP application?

To efficiently implement the functionality to display the "logged in" message across multiple pages in a PHP application, you can create a separate PHP file that contains the code for displaying the message. Then, include this file in the header or footer of each page where you want the message to appear using the PHP include() function.

// logged_in_message.php

<?php 
if(isset($_SESSION['logged_in'])){
    echo "Welcome, you are logged in!";
}
?>

```

To display the message on a specific page, include the following code snippet at the appropriate location in the page:

```php
// index.php

<?php
session_start();
include 'logged_in_message.php';
?>

<!-- Rest of the HTML content -->