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 compilation error because we did not use proper syntax of foreach loop. To access the elements of array, we need to use as keyword. The correct syntax is given below:
foreach ($ARR as $VAL) echo "$VAL <br>";
Answer 2:
Output:
Explanation:
In the above program, we created an array $ARR that contain values "SUN", "MON", "TUE", 10. Here, we access values from array one by one using foreach loop and print on the webpage using the echo statement.
Answer 3:
Output:
Explanation:
In the above program, we created an array $ARR that contain values "SUN", "MON", "TUE", 10.
Here, we access values from array one by one using foreach loop.
In the body of foreach loop, we used condition if($VAL==10) to terminate the loop, when the value of $VAL will be 10 then the loop will terminate.
Here we also used nested while loop that will access characters by one by from the string and print on the webpage.
Answer 4:
Output:
Explanation:
In the above program, we created an array $ARR that contain values "SUN", 10, "MON", "TUE", 10.
Here, we access values from array one by one using the foreach loop.
In the body of foreach loop, we used condition if($VAL==10) to skip some values, when the value of $VAL will be 10 then it will skip the execution of the loop body and move to the next element of the array.
Here, we also used nested while loop that will access character by one by from the string and print on the webpage.
Answer 5:
Output:
Explanation:
In the above program, we created an array $ARR that contains values "SUN", '10', "MON", "TUE", 10.
Here, we access values from array one by one using the foreach loop.
Here, we also used nested while loop that will access character by one by from the string and print on the webpage.
Using the nested loop, we cannot access integer value 10 then it will not print on the webpage.
need an explanation for this answer? contact us directly to get an explanation for this answer