what is the diffrence between for and foreach?

Answer Posted / web developer

for loop is to do something over and over again until the
task has been completed.

foreach works only on arrays. even it will run the loop
until end of the array.

Is This Answer Correct ?    120 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is php still in demand?

782


Swap two variables value without using third variable in php ?

848


How to write in a file in php?

760


When to use inquire vs enquire?

748


Tell me what is the difference between get and post?

724


How to track user logged out or not? When user is idle?

743


Explain how can we increase the execution time of a php script?

774


What is the different between count() and sizeof() in php?

748


What is the difference between myisam and innodb?

773


What is the method to execute a php script from the command line?

809


What is Type hinting in PHP?

927


Why and where do we use htaccess?

786


How to uploaded files to a table?

775


What are the ways to define a constant in php?

787


What is interface? Why it is used?

765