// ----------------------------
    // PHP, like C, supports 'static' local variables, that is, those that upon
    // first access are initialised, and thence retain their value between function
    // calls. However, the 'counter' example is better implemented as a class
    class Counter
    {
        private $counter;
        function __construct($counter_init)
        {
            $this->counter = $counter_init;
        }
        function next_counter()
        {
            $this->counter++;
            return $this->counter;
        }
        function prev_counter()
        {
            $this->counter;
            return $this->counter;
        }
    }
    // ------------
    $counter = new Counter(42);
    echo $counter->next_counter() . "\n";
    echo $counter->next_counter() . "\n";
    echo $counter->prev_counter() . "\n";
}
?>