1. Explain about switch statement in PHP?
Switch statement is executed line by line. PHP executes the statement only when the case statement matches the value of the switch expression. It does execute the statement until the end of the block till it finds the break statement. When the expression and statement matches themselves the code is executed.
2. Define about declare construct?
Declare construct allows you to define execution directives for a block set of code. This actually describes the way the code should perform. These declare construct can be set in such a manner that all the code is affected. The way the code performs can be set by the directive part which directly leads the code to follow.
3. Explain about looping in PHP?
Looping is used to run the same script many number of times. Following statements are used in PHP for looping while, do...while, for each, and for statement.
4. Explain about require and include function?
Include function collects all the text in a defined specific file and copies the text information to the file which has the include function in it
Require function is similar to the include function except that it handles the error system in a different manner. Require function displays a fatal error and stops the execution of the script while the include function still executes the script.
5. What is the alternative structure for control structures?
The basic control structures are if, for, while, do while, for each and switch. If you are planning to use alternative structures then the closing braces should be changed to endif, endfor, endwhile, endswitch, and endforeach. Similarly the opening brace of the alternative syntax should be changed to (:) or colon. The alternative structure is applicable to else and elseif also.
6. What are the different filter functions used to filter a variable?
A PHP filter validates, filters according to the predefined statements from the programmer. It is very important for every programmer to validate user defines information as it can potential harm; PHP eliminated this risk by using PHP filter extension. This forms a good security practice for programmers.
Switch statement is executed line by line. PHP executes the statement only when the case statement matches the value of the switch expression. It does execute the statement until the end of the block till it finds the break statement. When the expression and statement matches themselves the code is executed.
2. Define about declare construct?
Declare construct allows you to define execution directives for a block set of code. This actually describes the way the code should perform. These declare construct can be set in such a manner that all the code is affected. The way the code performs can be set by the directive part which directly leads the code to follow.
3. Explain about looping in PHP?
Looping is used to run the same script many number of times. Following statements are used in PHP for looping while, do...while, for each, and for statement.
4. Explain about require and include function?
Include function collects all the text in a defined specific file and copies the text information to the file which has the include function in it
Require function is similar to the include function except that it handles the error system in a different manner. Require function displays a fatal error and stops the execution of the script while the include function still executes the script.
5. What is the alternative structure for control structures?
The basic control structures are if, for, while, do while, for each and switch. If you are planning to use alternative structures then the closing braces should be changed to endif, endfor, endwhile, endswitch, and endforeach. Similarly the opening brace of the alternative syntax should be changed to (:) or colon. The alternative structure is applicable to else and elseif also.
6. What are the different filter functions used to filter a variable?
- Filter_var()
- Filter_var_array()
- Filter_input
- Filter_input_array
A PHP filter validates, filters according to the predefined statements from the programmer. It is very important for every programmer to validate user defines information as it can potential harm; PHP eliminated this risk by using PHP filter extension. This forms a good security practice for programmers.
No comments:
Post a Comment