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 is subroutine in perl?

887


What is the purpose of “_file_ literal” and “_line_ literal” in perl?

865


Explain chop?

864


What are the logical operators used for small scale operations?

905


What is the different between array and hash in perl programming?

872


How do I generate a list of all .html files in a directory?

898


What does Perl do if you try to exploit the execve(2) race involving setuid scripts?

889


Define operators used in perl?

881


Define dynamic scoping.

829


What does this symbol mean '->'?

916


How to check the status of airplane mode (enable/disable) in perl for Android mobile?

3032


What is q (single q) operator in perl?

1007


Demonstrate subroutines in perl with a simple example.

816


What does file test operators do in perl?

860


What are the advantages of c over Perl?

879