Code Insertion

To use the code from another file, include the file. The scope applied is the scope at the point of inclusion. The included file must start with <?php and end with ?>, otherwise it will be treated as HTML code. 1 is returned if the inclusion is successful, otherwise false is returned. An arbitrary value may be returned in the middle of the included file.

RESETRUNFULL
test.php:
<?php  //test.php
$a=100;
return 5;
?>

<!DOCTYPE html>
<html>
<head></head>
<body><?php
$b=include "test.php";
echo $a."$b";
?>
</body>
</html>
An alternative is to use require. The only difference is that upon failure, include merely generates a warning, whereas require results in an error and halts the script. To make sure files that have been included will not be included again, use include_once or require_once instead.

Try to declare a tick directive for a function to be called automatically after every one or more (tickable) statements.

RESETRUNFULL
<!DOCTYPE html>
<html>
<head></head>
<body><?php

declare(ticks=1);  // calls the tick handler after every
                         // tickable statement for the  rest of the code
function f(){
    echo "Tick Handler f Called.<br />";
}
register_tick_function('f');  // registers the tick handler 

echo "testing..."; $a=1;
echo "testing..."; $a=1;
echo "testing..."; $a=1;
echo "testing..."; $a=1;

declare (ticks=2){  // calls the tick handler after every 2
                                // tickable statements for the block
   echo "testing..."; $a=1;
   echo "testing..."; $a=1;
   echo "testing..."; $a=1;
   echo "testing..."; $a=1;
}
unregister_tick_function('f');
?>
</body>
</html>
Another directive to declare would be the encoding directive.

<?php
declare(encoding='ISO-8859-1');
// code here
?>