Showing posts with label PHP - String Funcitons. Show all posts
Showing posts with label PHP - String Funcitons. Show all posts

Thursday, June 26, 2008

PHP String Functions Part II

$str = "My name is O\'Billa?";
echo stripslashes($str);// Outputs: My name is O'Billa?

$str = "My name is O'Billa?";
echo stripslashes($str);// Outputs: My name is O\'Billa?

$str = "Vijay's next film Villu";
$str = strtoupper($str);
echo $str; // Prints VIJAY'S NEXT FILM VILLU

$str = "AJITH'S NEXT FILM AEGAN";
$str = strtoupper($str);
echo $str; // Prints ajith's next film aegan

Wednesday, June 25, 2008

PHP String Funcitons

$txt="PHP MYSQL";
echo $txt; // Returns PHP MYSQL (Print the text)

echo strlen("My first coding in PHP"); // Returns 22 (Print the string length)

echo strpos("Hello world","l"); // Returns 2 (Print the string position)

$email = 'ashokseenivas50@gmail.com';
$domain = strstr($email, '@');
echo $domain; // prints @gmail.com

$user = strstr($email, '@', true);
echo $user; // prints ashokseenivas50