PHP Interview questions


Total available count: 33
Subject - PHP Frameworks
Subsubject - PHP

What is need for using static variables?

One of the important feature of variable scoping is the static variable. A static variable available only in a local function scope, but it doesn’t lose its value when program execution leaves this scope. Consider the below example:

Example:

<?php
function test()
{
$x = 0;
echo $x;
$x++;
}
?>

 




Next 5 interview question(s)

1
What is the difference between global vs $GLOBALS?
2
What is Void?
3
What is the difference between gettype() vs str replace?
4
What is NaN?
5
PHP supports 8 primitive types. What are they?