Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

static variable php


<?php
function foo(){
    static $int = 0;          // correct 
    static $int = 1+2;        // correct
    static $int = sqrt(121);  // wrong  (as it is a function)

    $int++;
    echo $int;
}
?>

Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #static #variable #php
ADD COMMENT
Topic
Name
7+9 =