Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Web Developer Interviews:BootstrapFront End Web DeveloperHTML DeveloperHybrid Application DeveloperInternee PHP DeveloperJnr PHP/Codeigniter DeveloperJunior Developer PHPLaravel PHP DeveloperPython DeveloperRuby DeveloperTypographyWeb Developer & DesignerWeb Developer Cum SEO AnalystWeb Development NinjasWebsite DeveloperWordPress Themes Developer
Copyright © 2018. All Rights Reserved
Junior Developer PHP Interview Question:
Explain what is the static variable in function useful for?
Submitted by: AdministratorA 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:
<!--?php
function testFunction()
{
static $testVariable = 1;
echo $testVariable;
$testVariable++;
}
testFunction(); //1
testFunction(); //2
testFunction(); //3
?-->
Submitted by:
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.