178. PHP Program to work as strrchr() function.
How does this program work?
- In this program you are going to learn about how to works as strrchr() function in PHP.
Here is the code
<html>
<head>
<title>PHP Program To works as strrchr() function</title>
</head>
<body>
<form method="post">
<table border="0">
<tr>
<td> <input type="text" name="num" value="" placeholder="Enter String"/> </td>
</tr>
<tr>
<td> <input type="text" name="num1" value="" placeholder="Enter search word"/> </td>
</tr>
<tr>
<td> <input type="submit" name="submit" value="Submit"/> </td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit'])) {
$str = $_POST['num'];
$search = $_POST['num1'];
//To print Original String
echo "The Original String is : ".$str."</br>";
//It is used to find the position of the last occurrence of a String
$ch = strrchr($str, $search);
echo "The modified string is : ".$ch;
}
?>
</body>
</html>