what is the diffrence between for and foreach?

Answer Posted / krunal gohel

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 ?    15 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is constructors and destructors?

540


How can you compare objects in php?

510


What is ci in php?

545


Explain the three different kinds of Arrays?

657


What is polymorphism in php?

514






What is php dependency injection?

528


How do you destroy a session?

504


Explain php explode() function.

550


What is the interface in php?

536


Difference between array_combine and array_merge?

529


How do I run a php file?

514


What is the difference between Split and Explode in PHP?

576


What is mean by an associative array?

537


Do you know what does mvc stand for and what does each component do?

507


Why do you need to filter out empty files?

536