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 NULL?
What is the role of the .htaccess file in php?
What's the output of the ucwords function in this example?
Explain the difference between static and dynamic websites?
Which function will you use to create an array?
Does php require a web server?
How to create an empty array in php?
How many escape sequences are recognized in double-quoted strings?
How to send a cookie to the browser?
What is the difference between javascript and php?
How to convert one date format into another in php?
What is php oops concepts?
What are different types of errors available in Php?
Hi this is amul jani here, i complied my graduation in B.com stream.. but as career i looking for PHP language.. to get shape my career. so is that possible to enter in IT world.. for me how much scope of develop my career in this field.. amul jani
what is variable scope, which variables are accessible from where and what are "undefined variable" errors?