PHP Programs

Our aim is to connect students from campuses all over Delhi by making them aware of all Technical, Cultural, Management fests, workshops, Seminars organized by every college in Delhi.

Join Us Now

Program 43: Write a program to replace lower-case characters with upper-case and vice versa.


<!DOCTYPE html>  
	<title>PHP Programs</title>
		$str = "Preeti Pradhan ";  

		for($i = 0; $i < strlen($str); $i++)
			if($str[$i] >= 'a' && $str[$i] <= 'z')
				$str[$i] = strtoupper($str[$i]);  
			else if($str[$i] >= 'A' && $str[$i] <= 'Z')
				$str[$i] = strtolower($str[$i]);  

		echo "String after case conversion : $str";  

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.