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
Why does php start with variables?
What is $this in php?
What are the characteristics of php variables?
What are getters and setters php?
Why do we show php code in browser?
What was the old name of php?
What does session start do in php?
Why session is required?
What is the function to count elements in an array in PHP?
How to get no. of rows using MYSQL function?
What is form submission?
What does echo mean in php?
How to create a web form?
What sized websites have you worked on in the past?
Why is php so popular?