breaking condition statements

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

breaking condition statements

Post by kendall »

Hey,

I tried searching the forums for this topic but i get soooo many unecesary posts so i am posting it anyway...sorry guys

i am using a break/ conitnue statement to get out of an if statement to go back to the begining of a function

Code: Select all

while(false !== ($content = $directory->read())){
		if(($content != '..') && ($content != '.')){
			if($TYPE){
				// get files that match
				if($TYPE == 'file' && strstr($content,$MATCH) && !is_dir($path.$content))
					$CONTENTS[] = $content;
				// get folders that match
				if($TYPE == 'folder'){
                    // check to see if its a directory
                    if(!is_file($path.$content)){
                        // if i need to match content
                        if($MATCH){
                          if(strstr($content,$MATCH)){
                            $CONTENTS[] = $content;
                            continue; // breaking to go back to the top
                          }
                        }
                        $CONTENTS[] = $content;
                    }

                }
					
			}else{
				$CONTENTS[]=$content;
			}
		}
Am i breaking this correctly or do i need to specify a parameter?
Kendall
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Long time no see, stranger!

$TYPE isn't set in there, should it be?
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

breaking condition statements

Post by kendall »

Hey feyd,

Yep i have been concentrating on actionscript of late. back on the php

TYPE and MATCH are option parameters
but im dealing with TYPE being set at the moment

Kendall
Post Reply