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 session in php w3schools?
What are the benefits of using queries?
What does mysqli_query return?
What is the sign to start variables in PHP?
Explain type casting and type juggling.
What is file upload?
How to redirect a page in php?
What is the output of the ucwords function in this example?
What is the use of ajax in php?
What are static variables in php?
Is php a mvc?
Tell me how can we check the value of a given variable is alphanumeric?
What is session cookies php?
How can you upload a file using php?
What are the uses of php language?