Hi,
I'm a perl programmer and am trying to learn PHP.
So far I have figured out most of the differences, but have not been able to
find out how to do the following:
When running through a loop, how can you test two separate conditions
against the same $element of an array. For example, this is how I thought it
would be done (similar to Perl), but it did not work:
if (eregi("apple", $line) and (eregi("orange" , $line) {
do whatever;
}
Basically testing each line of an array to see if both the words "apple" and
"orange" are present.
Also, is there any equivalent to the following from Perl while running
through a loop:
next if (whatever conditions);
last if (whatever conditions);
Thanks,
Max
I'm a perl programmer and am trying to learn PHP.
So far I have figured out most of the differences, but have not been able to
find out how to do the following:
When running through a loop, how can you test two separate conditions
against the same $element of an array. For example, this is how I thought it
would be done (similar to Perl), but it did not work:
if (eregi("apple", $line) and (eregi("orange" , $line) {
do whatever;
}
Basically testing each line of an array to see if both the words "apple" and
"orange" are present.
Also, is there any equivalent to the following from Perl while running
through a loop:
next if (whatever conditions);
last if (whatever conditions);
Thanks,
Max
Comment