what is the diffrence between for and foreach?
Answer Posted / tarsem kurra
foreach is used to iterate over arrays and for loop is used
to run statement for number of times and there is another
major difference is in foreach you want to execute statement
which comes from an database with id which is
autoincremented and you run for loop over it and suppose in
the mean time i delete 3rd rows i.e. 3rd id than what will
this loop stops working but not in foreach and foreach is
the faster than for loop..
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Where to put php files in apache server?
What is a php class?
How cookies are trported from browsers to servers?
How is it possible to parse a configuration file?
How to delete an element from an array?
Explain object-oriented methodology in php?
How can we determine whether a variable is set?
Explain soundex() and metaphone().
How do we get the current session id?
What is call by reference in php?
How to pad an array with the same value multiple times?
What is api used for?
What is the use of nl2br() in php?
What is a PHP accelerator?
What does the scope of variables means?