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
How can we determine whether a php variable is an instantiated object of a certain class?
How to write php function in html onclick?
Explain how you can update memcached when you make changes to php?
What is the function of trim?
What is the difference between characters 34 and x34?
What is full form of php? Who is the father or inventor of php?
Is php a web server?
What are differences between PECL and PEAR?
How can we access the data sent through the url with the get method?
What is string function sql?
What is mysqli_real_escape_string?
What is the use of imagetypes() method?
Tell me how can we check the value of a given variable is alphanumeric?
Are php short tags acceptable to use?
Explain object-oriented methodology in php?