Q:
PHP find output programs (static variables, classes, methods) | set 1
belongs to collection: PHP Find Output Programs
PHP Find Output Programs
- PHP find output programs (basics) | set 1
- PHP find output programs (basics) | set 2
- PHP find output programs (basics) | set 3
- PHP find output programs (Superglobals) | set 1
- PHP find output programs (conditional statements) | set 1
- PHP find output programs (conditional statements) | set 2
- PHP find output programs (conditional statements) | set 3
- PHP find output programs (switch Statement) | set 1
- PHP find output programs (switch Statement) | set 2
- PHP find output programs (switch Statement) | set 3
- PHP find output programs (Operators) | set 1
- PHP find output programs (Operators) | set 2
- PHP find output programs (Operators) | set 3
- PHP find output programs (Loops) | set 1
- PHP find output programs (Loops) | set 2
- PHP find output programs (Loops) | set 3
- PHP find output programs (Loops) | set 4
- PHP find output programs (Arrays) | set 1
- PHP find output programs (Arrays) | set 2
- PHP find output programs (Arrays) | set 3
- PHP find output programs (User-defined functions) | set 1
- PHP find output programs (User-defined functions) | set 2
- PHP find output programs (User-defined functions) | set 3
- PHP find output programs (String Functions) | set 1
- PHP find output programs (String Functions) | set 2
- PHP find output programs (Number Functions) | set 1
- PHP find output programs (Math Functions) | set 1
- PHP find output programs (Math Functions) | set 2
- PHP find output programs (Date and Time) | set 1
- PHP find output programs (define Constant) | set 1
- PHP find output programs (static variables, classes, methods) | set 1
- PHP find output programs (static variables, classes, methods) | set 2
- PHP find output programs (Regular Expressions) | set 1
- PHP find output programs (Exceptions) | set 1
- PHP find output programs (Exceptions) | set 2
- PHP find output programs (Filters) | set 1
- PHP find output programs (Filters) | set 2
- PHP find output programs (JSON) | set 1
- PHP find output programs (const Keyword) | set 1
- PHP find output programs (Class & Objects) | set 1
- PHP find output programs (Class & Objects) | set 2
- PHP find output programs (Class & Objects) | set 3
- PHP find output programs (Constructors and Destructors) | set 1
- PHP find output programs (Constructors and Destructors) | set 2
- PHP find output programs (Constructors and Destructors) | set 3
- PHP find output programs (Inheritance) | set 1
- PHP find output programs (Inheritance) | set 2
- PHP find output programs (Inheritance) | set 3
Answer 1:
Output:
Explanation:
The above program will generate syntax error, because if you want to call a static function into a non-static function of the same class, then we need to use the self keyword with '::' operator. The correct program is given below:
Answer 2:
Output:
Explanation:
In the above program, we created a class that contains a static function fun1() and a non-static function fun2(). Then we created the object of class Sample, and here we called static function fun1() using scope resolution operator :: and non-static using -> operator. Then the above output will be printed on the webpage.
Answer 3:
Output:
Explanation:
In the above program, we created a class that contains a static function fun1() and a non-static function fun2(). Then we created the object of class Sample, and here we called both functions fun1() and fun2() using scope resolution operator "::" with an object instead of "->". We can also access non-static members using scope resolution operator "::' in PHP. Then the above output will be printed on the webpage.
Answer 4:
Output:
Explanation:
The above program will generate PHP notices and errors, because if we want to access static data member inside the class then we need to use self keyword, but we did not use in the constructor while using $count.
Answer 5:
Output:
Explanation:
The above program will generate an error because we missed the function keyword in the definition of GetCount() function.
need an explanation for this answer? contact us directly to get an explanation for this answer