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
Explain me what is the importance of "method" attribute in a html form?
Tell me how to get the value of current session id?
Is php the same as html?
What is difference between variable declaration and variable definition?
What are the 3 types of sessions?
How can I convert ereg expressions to preg in php?
What is htaccess? Why do we use this and where?
How big is nvarchar max?
What is a controller in php?
How to access a Static Member of a Class in PHP?
What is 'float' property in css?
What is the use of die in php?
How a variable is declared in php?
What is the difference between javascript and php?
How to find a substring from a given string in php?