PHP – Code Reuse – include

Using includes you can reuse the same code in multiple scripts.

//include.php
<?php

$time = time();

include 'included.php';

print $message;

print "</br>";

print $time;

?>
//included.php
<?php

$message = "HELLO WORLD FROM AN INCLUDE";

?>

Be the first to comment

Leave a Reply