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 difference between for & foreach, exec &
system?

Answer Posted / raj

Ofcourse the syntax is completely different but the only
difference is
foreach simply gives an easy way to iterate over arrays.
foreach works only on arrays,
and will issue an error when you try to use it on a variable
with a different data type or an uninitialized variable
where as for loop works on the count length or what ever
please look in to php.net site for reference.

Thanks,
Raj

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What package you use to create a windows services?

929


Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.

1074


What is the purpose of redo statement?

1060


How to print escaping characters inside a string in perl?

953


Why should I use the -w argument with my Perl programs?

1005


How to find the length of an array in perl?

1059


What is the function of virtual documents in cgi programs?

1009


What is epoch time in perl?

982


What is warn function in perl?

1020


How many loop control keywords are there in perl?

987


What are the logical operators used for small scale operations? Explain them briefly.

1030


How can you define “my” variables scope in Perl and how it is different from “local” variable scope?

1191


How to access parameters passed to a subroutine in perl?

1008


What does localtime() do in perl?

1050


What's the difference between /^Foo/s and /^Foo/?

1263