Jump to content

Can a varaible be global and static


rubing

Recommended Posts

All variables defined at page level (not inside a function) are static

 

mjdamato,

oh yes it is

<?php
function testStatic ()
{
    static $a;
    
    echo ++$a, '<br />';
}

testStatic();
testStatic();
testStatic();
?>

 

http://us3.php.net/manual/en/language.variables.scope.php (scroll down a bit)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.