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

Explain goto name?

509


What is warn function in perl?

526


What syntax is used for grep() function?

564


How can memory be managed in Perl?

534


How can information be put into hashes?

527






Define perl scripting?

569


what are the three groups involved in information sharing?

470


How to create a package?

517


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

506


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

531


How to copy a file in perl?

508


Explain socket programming in perl?

498


“Perl regular expressions match the longest string possible”. What is the name of this match?

519


Write a program to show the process of spawning a child process

445


What is perl scripting?

508