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:
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.
Now look apart from arraylen() function, 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 arrayLen() 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 2:
Output:
Explanation:
The above program will generate a PHP notice because we created an associative array that cannot be accessed using an index.
Answer 3:
Output:
Explanation:
The above program will generate PHP notice because in the defined associative array "101" is the value, and "Rahul" is the key and we can access the value using the key. The below statement will print "101".
echo $student["Rahul"];
Answer 4:
Output:
Explanation:
In the above program, we created an associative array that contains keys and associated values. Then we used a "foreach" loop to access keys and values and then print them on the webpage.
Answer 5:
Output:
Explanation:
In the above program, we defined two-d array, here we defined three nested arrays, then we accessed array elements with the help of nested loop, we accessed elements row-wise and print them on the webpage.
need an explanation for this answer? contact us directly to get an explanation for this answer