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
What is the difference between mysql_fetch_array() and mysql_fetch_assoc()?
What is the use of Php variables?
What is the alternative structure for control structures?
What is cakephp framework?
What is phpsessid?
How send email in php?
How to run the interactive php shell from the command line interface?
What are magic constants in php?
Tell me what the difference between the 'bitwise and' operator and the 'logical and' operator?
What is exception handling in php?
What sized websites have you worked on in the past?
How does firefox manage cookies?
Tell me what sized websites have you worked on in the past?
Why namespace is used in php?
What does $globals means?