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

How to read a single line from a file in perl?

935


How the interpreter is used in Perl?

910


Why do you use Perl?

934


Who created perl?

881


For a situation in programming, how can you determine that Perl is a suitable?

851


What is perl scripting?

885


What happens when you return a reference to a private variable?

953


Explain goto label?

879


What is the usage of -i and 0s options?

936


How do I sort a hash by the hash key?

884


If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?

952


What are the steps involved when the cgi program starts running?

874


How we can navigate the xml documents?

943


Write a program that shows the distinction between child and parent process?

892


Write a program to download the contents from www.perlinterview.com/answers.php website in Perl.

862