Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to access a global variable inside a function?

1012


Where is session value stored?

1004


Is laravel easy to learn?

969


What is the difference between single-quoted and double-quoted strings in php?

1098


What does the unlink() function mean?

1092


How does the identity operator ===compare two values in PHP?

1111


Who is known as the father of php?

1142


What is the interface in php?

1033


Which is better get or post method?

920


How to create an array from php string?

1054


What do you mean range() in php?

1100


Do you know what is the difference between mysql_fetch_object() and mysql_fetch_array()?

1012


Tell me how stop the execution of a php scrip?

993


what is CURL?

1030


How is php different from other languages?

897