public static function move($source, $destination)
    {
        $returnValue = (bool) false;

        if(is_dir($source)){
			if(!file_exists($destination)){
				mkdir($destination, 0777, true);
			}
			$error = false;
			foreach(scandir($source) as $file){
				if($file != '.' && $file != '..'){
					if(is_dir($source.'/'.$file)){
						if(!self::move($source.'/'.$file, $destination.'/'.$file, true)){
							$error = true;
						}
					}
					else{
						if(!self::copy($source.'/'.$file, $destination.'/'.$file, true)){
							$error = true;
						}
					}
				}
			}
			if(!$error){
				$returnValue = true;
			}
			self::remove($source, true);
		}
		else{
	        if(file_exists($source) && file_exists($destination)){
	        	$returnValue = rename($source, $destination);
	        }
	        else{
	        	if(self::copy($source, $destination, true)){
	        		$returnValue = self::remove($source);
	        	}
	        }
		}

        return (bool) $returnValue;
    }
public static function move($source, $destination)
    {
        $returnValue = (bool) false;

        if(is_dir($source)){
			if(!file_exists($destination)){
				mkdir($destination, 0777, true);
			}
			$error = false;
			foreach(scandir($source) as $file){
				if($file != '.' && $file != '..'){
					if(is_dir($source.'/'.$file)){
						if(!self::move($source.'/'.$file, $destination.'/'.$file, true)){
							$error = true;
						}
					}
					else{
						if(!self::copy($source.'/'.$file, $destination.'/'.$file, true)){
							$error = true;
						}
					}
				}
			}
			if(!$error){
				$returnValue = true;
			}
			self::remove($source, true);
		}
		else{
	        if(file_exists($source) && file_exists($destination)){
	        	$returnValue = rename($source, $destination);
	        }
	        else{
	        	if(self::copy($source, $destination, true)){
	        		$returnValue = self::remove($source);
	        	}
	        }
		}

        return (bool) $returnValue;
    }
public static function move ( $ source , $ destination ) { $ returnValue = ( bool ) false ; if ( is_dir ( $ source ) ) { if ( ! file_exists ( $ destination ) ) { mkdir ( $ destination , 0777 , true ) ; } $ error = false ; foreach ( scandir ( $ source ) as $ file ) { if ( $ file != '.' && $ file != '..' ) { if ( is_dir ( $ source . '/' . $ file ) ) { if ( ! self :: move ( $ source . '/' . $ file , $ destination . '/' . $ file , true ) ) { $ error = true ; } } else { if ( ! self :: copy ( $ source . '/' . $ file , $ destination . '/' . $ file , true ) ) { $ error = true ; } } } } if ( ! $ error ) { $ returnValue = true ; } self :: remove ( $ source , true ) ; } else { if ( file_exists ( $ source ) && file_exists ( $ destination ) ) { $ returnValue = rename ( $ source , $ destination ) ; } else { if ( self :: copy ( $ source , $ destination , true ) ) { $ returnValue = self :: remove ( $ source ) ; } } } return ( bool ) $ returnValue ; }
Move file from source to destination.

@author Lionel Lecaque, <lionel@taotesting.com>
@param  string $source A path to the source file.
@param  string $destination A path to the destination file.
@return boolean Returns true if the file was successfully moved, false otherwise.
Move file from source to destination .