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
Answer1:-
Output:
Explanation:
The above program will generate a compilation error because length() is not a built-in function. We need to use count() function to get the length of the specified array.
Answer 2:
Output:
Explanation:
In the above program, we created an array of integer elements. Here, we used do…while() loop which is useless because we used break statement at the end of the body of do…while() loop, then it will execute only once.
Now look to the inner loop, here counter variable $i will move from 0 to 5 because count() function will return 6. Inside the loop, we check every element of the array, which is an even number or not. If the number is even then we print those numbers on the webpage.
Answer 3:
Output:
Explanation:
The above program will print 7 on the webpage. In the above program, we created an array of integer elements, and we defined a function arrayLen(), which is used to count the total number of elements in the array. In the arrayLen() we check every element of the array, and checked it is an integer number, is_int() function will return 0, if it is not an integer number. Here we use a post-increment operator with $i, then it will reach till 7.
Answer 4:
Output:
Explanation:
The above program will print 1 on the webpage. In the above program, we created an array of integer elements, and we defined a function arrayLen(), which is used to count the total number of elements in the array, but $arr inside the function arrayLen() is different from the above-defined array. That's why it arrayLen() will return 1.
Answet 5:
Output:
Explanation:
The above program will generate syntax error because isint() is not a built-in function. is_int() function is used to check the specified variable is an integer number or not.
need an explanation for this answer? contact us directly to get an explanation for this answer