You have a loop in your PHP script and you want to skip the rest of the current iteration and move on to the next one if a certain condition is met. How would you do this using continue?
- Use the continue statement to skip the rest of the current iteration and move to the next iteration.
- Use the break statement to terminate the loop execution.
- Use the exit statement to stop the script execution.
- Use the return statement to exit the loop and return a value.
The correct option is: "Use the continue statement to skip the rest of the current iteration and move to the next iteration." The continue statement in PHP is used to skip the remaining code in the current iteration of the loop and move to the next iteration. It allows you to bypass further execution within the current iteration based on a certain condition. Learn more: https://www.php.net/manual/en/control-structures.continue.php
Loading...
Related Quiz
- PHP supports two types of numbers: integers and ______.
- In PHP, to handle a form, you can use the $_POST or $_GET superglobal to access the data, where the method used depends on the ______ attribute of the form element in the HTML.
- In PHP, variables declared inside a function can be accessed outside of that function.
- What are the two main string operators?
- What is the purpose of the array_search() function in PHP?