what is the diffrence between for and foreach?

Answer Posted / swapnil

well when we use for loop it will execute only for the time
we have mentioned in loop ie ex for(i=0;i<25;i++) 25 times
whereas foreach is used only when we dont know that limit it
may be the case when we perform operation on database queries

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Tell me what is the meaning of a final class and a final method?

521


What is the difference between apache and tomcat?

526


How do you explain independent and dependent variables?

489


Tell me what is the main difference between require() and require_once()?

542


How to get complete current page url in php?

553






How can we enable error reporting in php?

467


What is singleton design pattern in php?

550


What is crypt () in php?

486


What is helper library?

506


What is member variable?

546


What are differences between PECL and PEAR?

512


How easy is php?

522


Why is overriding runtime?

568


What is "echo" in php?

529


Why would we use === instead of ==?

8347