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 / p parimi

For can be used to run statements for a fixed number of
times, foreach can be used to run statements for dynamically
generated arrays(may be result of database query).We can
also used for loop for dynamically generated array(may be
result of database query) but foreach is the ideal way to
iterate dynamic array. The reason behind this, we don't know
the index of array as it may be associate result from
database query. So if we use foreach than it will iterate
the result one by one.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Please explain is it possible to use com component in php?

1012


How can you make a connection with mysql server using php?

993


Which php function will attach one file to another?

994


How can you retrieve a cookie value?

1086


What are the differences between echo and print?

1007


How can we enable error reporting in php?

1052


Explain how is it possible to cast types in php?

984


What is php glob?

1013


Is java is better than php?

1007


Is php procedural or oop?

999


What is htaccess in php?

1292


When are you supposed to use endif to end the conditional statement?

953


Explain what does the function get_magic_quotes_gpc() means?

941


A process is identified by a unique___

1075


What is the correct syntax of mail() function in php?

1027