Saturday, September 7, 2013

STRING FUNCTIONS (PART-2)

Example: 1


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();


//strrev();

echo strrev("Hellow");

?>



Example: 2


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();


//strtolower();

$string ="HELLOW";
echo strtolower($string);

?>



Example 3


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();


//strtolower();

$string ="hellow";
echo strtoupper($string);

?>



Example 4


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();


//strtolower();

$string ="hellow";
echo strtoupper($string);

?>



Example 5


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();


//strtolower();

$username ="hellow";
$storedusername= strtoupper($username);

?>


Example 6


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();

//substr_count();

$search ="My name is alex. What is Your name?";
$result =substr_count($search,"alex");
echo $result;

?>


Example 7


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();

//substr_count();

$search ="My name is alex. What is Your name?";
$result =substr_count($search,"name");
echo $result;

?>


Example 8


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();

//substr_count();

$search ="My name is alex. What is Your name?";
$result =substr_count($search,"name",7);
echo $result;

?>


Example 9


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();

//substr_count();

$search ="My name is alex. What is Your name?";
$result =substr_count($search,"name",7,17);
echo $result;

?>


Example 10


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();

//substr_count();

$search ="My name is alex. What is Your name?";
$result =substr_count($search,"alex",7,17);
echo $result;

?>



Example 11


<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();

//substr_replace();

$replace ="My name is alex.";
$result =substr_replace($replace,"Billy",11,14);
echo $result;

?>


Example 12



<?php

//strrev();
//strtolower();
//strtoupper();
//substr_count();
//substr_replace();

//substr_replace();

$replace ="My name is alex.";
$result =substr_replace($replace,"Billy",10,14);
echo $result;

?>





No comments: