PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 5: Create a PHP page which accepts string from user. After submission that page displays the reverse of provided string.

reverse.php

<!DOCTYPE html>
<html>
<head>
	<title>PHP Programs TutorialDuniya.com</title>
</head>
<body>
	<form method="POST" action="">
		enter a string : <input type="Text" name="string1">
		<br/>
		<input type="Submit" name="submit" value="Reverse_String">
	</form>
	
	<?php
	if(isset($_POST["submit"]) == "Reverse_String")
	{
		$str1=$_POST["string1"];
		echo"the string is : $str1 <br/>";

		$str2=strrev($str1);
		echo "reversed string is : $str2";
	}
	?>
</body>
</html>



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.