I have 2 php files.
index.php:
<?php
$counter = 0;
require_once('temp.php');
temp();
echo $counter;
?>
temp.php:
<?php
function temp() {
tempHelper();
}
function tempHelper() {
$counter++;
}
?>
I want to print 1 not 0. I tried to set $counter as global variable without success.
What can I do?