Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] webmail now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as Plain Text by registered user arbaazssaah ( 4 years ago )
STR_REPLACE()
<?php
$text    = "Replacing text";
$replace = str_replace("text","string",$text);
echo $replace;
...........................................................
STRLEN()
<?DOCTYPE html>
<html>
	<head>
		<title>Length Of A String</title>
	</head>
	<body>
		<form action="" method="post">
		<input type="text" name="string"><br>
		<input type="submit" name="submit" value="Submit" >
		</form>
	</body>
</html>
<?php 
if(isset($_POST['submit'])){
	$string=$_POST['string'];
	$reverse=strrev($string);
	echo "The Reverse of String is ".$reverse;
}
.....................................................................
STRREV()
<?DOCTYPE html>
<html>
	<head>
		<title>Length Of A String</title>
	</head>
	<body>
		<form action="" method="post">
		<input type="text" name="string"><br>
		<input type="submit" name="submit" value="Submit" >
		</form>
	</body>
</html>
<?php 
if(isset($_POST['submit'])){
	$string=$_POST['string'];
	$length=strlen($string);
	echo "The Length is ".$length;
}

.....................................................................................
TRIM()
<?php
$str1="Trim              ";
print rtrim($str1);
$str2="              Trim";
print ltrim($str2);
$str3="          Trim              ";
print trim($str3);
?>
..........................................................
STRPOS()
<form action="" method="POST">
Text:<br>
<input type="text" id="text" name="text" ><br>
Search:<br>
<input type="text" id="text" name="search" ><br>

<input type="submit" name="submit" value="Submit">
</form>
<?php
if(isset($_POST["submit"]))
{
 $text=$_POST['text'];
  $search=$_POST['search'];
 echo "Position:";
	echo strpos("$text","$search");
}
?>

 

Revise this Paste

Your Name: Code Language: