Interviewer And Interviewee Guide

Junior Developer PHP Interview Question:

Explain what is the static variable in function useful for?

Submitted by: Administrator
A static variable is defined within a function only the first time and its value can be modified during function calls as follows:

<!--?php
function testFunction()
{
static $testVariable = 1;
echo $testVariable;
$testVariable++;
}

testFunction(); //1
testFunction(); //2
testFunction(); //3
?-->
Submitted by:

Read Online Junior Developer PHP Job Interview Questions And Answers
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.