VisualBuilder
  Home > Php > Tutorials > String Manipulation - PHP Tutorial
Tell a friend
Link to us
Total Members
      Members: 84661
     
Sitemap Forum Chat
Home
PHP Tutorial Home
1 . An Introduction to PHP
2 . Getting Started With Variables
3 . Comments in PHP
4 . Operators
5 . The Switch Statement
6 . Logical Operators
7 . Boolean Values
8 . Working with HTML Forms
9 . Programming Loops
10 . Arrays in PHP
11 . String Manipulation
12 . Create your own Functions
13 . Date and Time Functions in PHP
14 . Working With Files In PHP
 
 
PHP Home
PHP Members (3076)
PHP Member Articles ( 9 )
PHP Discussion (11)
PHP Q & A ( 13 )
- PHP Ask Question
- PHP Questions
- PHP Unanswered Questions
PHP Resources
PHP Source Code (463)
PHP Articles (118)
PHP Blogs (30)
PHP Jobs (0)
PHP Components (24)
PHP Books (3)
PHP Websites (29)
PHP News (17)
 
GROUPS
.NET
ASP.NET
.NET
C#
ASP
Visual Basic
Java
Java
JSP
EJB
Other
Delphi
C++
Ajax
UML
JavaScript
PHP
Web Design
Web Hosting
SQL Server
Oracle
Project Management
More Groups

 
LEARNING CENTER
TUTORIALS
.NET
.NET Tutorial
ASP Tutorial
ASP.NET Database Tutorial
ASP.Net Security,Internationalisation And Deployment
ASP.NET Tutorial
C# Tutorial
Web Development
Flex Tutorial
HTML Tutorial
Learn AJAX Tutorial
PHP Tutorial
Software Development
Database Tutorial
SQL Tutorial
UML Tutorial
Java
Ant Tutorial
EJB 3 Tutorial
Hibernate Tutorial
Java Tutorial
Java Web Component Tutorial
Java XML Tutorial
JDBC Tutorial
JDK1.5 Tutorial
JSF Tutorial
JSP And J2EE Design Tutorial
JSP Tutorial
Spring Tutorial
Struts Tutorial

RESOURCES
Q & A (451 )
Source Code (3275 )
Articles (359 )
Books (372 )
Components (1596 )
News (892 )
Websites (1207 )

SUBMISSIONS
Submit Article
Submit Website
Submit News
Submit Source Code
Submit Component

COMMUNITY
Members Directory
Discussion Forum
Chat

SITE
About Us
Sitemap
Search
Contact Us
Link To Us
Feedback
Tell a Friend
Partners
Advertise

Php Tutorial
 String Manipulation
  << Prev: Arrays in PHP Next: Create your own Functions >>

String Manipulation 

1. Changing Case


<?


$full_name = 'nicholas cage';


$full_name = ucwords($full_name);


echo $full_name;


 


// Use strtolower and strtoupper functions too


?>



2. Trimming White Space


<?


trim(" Test "); // Remove white space from both sides of a string


ltrim(" Test "); // Remove white space from left side of a string


rtrim(" Test "); // Remove white space from right side of a string


?>



3. Shuffle characters


<?


$full_name = 'nicholas cage';


$full_name = str_shuffle($full_name);


echo $full_name;


?>



4. Finding String Positions with strpos


<?


$full_name = "nicholas";
$letter_position = strpos($full_name,"h");
echo $letter_position;


?>



5. Splitting a line of text


<?


$full_name = "Jaydra,Joe,Elizabeth,Abby,Vilma,Laura";
$names = explode(",",$full_name);  // Returns an array by breaking string with "," sign
echo $names[0];


?>


  << Prev: Arrays in PHP Next: Create your own Functions >>
Php Tutorial Home
Give feedback and win a prize.

 
   Printer Friendly
   Email to a friend
   Add to my Favourites    
  Download PDF version
   Report Bad Submissions
   Submit Feedback
 
  Delicious   Digg   Technorati   Blink   Furl   Reddit   Newsvine   Google Click each image to add
this page to each site.
 
 
Welcome Guest Signup
MEMBER'S PANEL
EMAIL
PASSWORD
Forgot your password?
New User? Click Here!
 
Resend Activation Email!
 
SEARCH
 
 
 
ADVERTISEMENT
Partner List
Code Project
ASP Alliance
More
 
 
 
 

Home | Login | About Us | Contact Us | Privacy Policy | Advertising