PHP Programs

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

Program 17: Write a PHP program check a function to reverse a string.


<!DOCTYPE html>
	<title>PHP Progarms</title>
		function reverse_string($str1)
			$num = strlen($str1);
			if($num == 1)
				return $str1;
				return reverse_string(substr($str1 ,1, $num)) . substr($str1, 0, 1);
		print_r(reverse_string('REST') . "\n");

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.