Hello,
Im trying to understand the correct usage of the continue statement...im having a bit of a hard time comprehending the manual's examples
i have the following code
[syntax=php]for($i=0; $i<5 ; $i++){
if($imagetype != 'jpeg')
continue;
if($imagesize>max_size)
continue
savefile($image);
}[/syntax]
Now what i am attempting is that if the imagetype is not jpeg or if the imagesize is over the max skip this file and go to the next file to validate other wise it will savefile($image);
however i dont seem to be getting the desired result
can someone explain what im suppose to do with the continue?
Kendall
continue statement
Moderator: General Moderators
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
continue statement
Elobrating on what m@ndio said,
what your saying is that if
if($imagetype == 'jpeg'){
it will continue on to the if 2 statement?
}
if($imagesize > size) // this is the if 2 statement?
or is it the save statement?
savefile($image); ?
what your saying is that if
if($imagetype == 'jpeg'){
it will continue on to the if 2 statement?
}
if($imagesize > size) // this is the if 2 statement?
or is it the save statement?
savefile($image); ?
Code: Select all
<?php
define ('COLD',35);
define ('FROZEN',25);
for ($i=40 ; $i ; $i--)
{
# Do some "cool stuff"
echo 'Current temp is '. $i;
if ($beer < COLD) continue; // This will return to the top of the loop and keep it cooling (Until $i is less than 35)
echo 'Its cold now '.$i;
if ($beer < FROZEN) break; // This will exit the forloop and continue with "its frozen" when $i reaches 25
}
echo 'Ugh, it frozen!';
?>