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 the purpose of _package_ literal?

537


If you want to empty an array then how would you do that?

578


Explain USE and REQUIREMENT statements?

561


What is perl I used for?

531


What interface used in PERL to connect to database? How do you connect to database in Perl?

534






In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

532


what are steps to do to lock the sony ericsson mobile with password?

1814


List all the features of perl programming?

512


What are stdin, stdout and stderr?

515


What is automatic error handling in perl?

504


How do I pass a command line argument in perl?

555


Why Perl aliases are considered to be faster than references?

546


What is the peculiarity of returning values by subroutines in perl?

486


What is it meants by '$_'?

541


What are the different string manipulation operators in perl?

533