2
Most read
5
Most read
9
Most read
PHP String Function
ADMEC MULTIMEDIA
Leader in Animation & Digital Media Education
ISO 9001:2008 CERTIFIED | ADOBE Testing Center
www.admecindia.co.in
PHP string function helps us to manipulate string in
various ways.
There are various types of string function available.
Here we discuss some important functions and its use
with examples.
1.echo
2.strtolower ( )
3.strtoupper ( )
4.lcfirst()
5.ucfirst()
6.ucwords()
7.substr_replace ( )
1. echo: It is used to print one or more string .Echo
function is faster than print print function.
Example:
<!doctype <!DOCTYPE html>
<html>
<head>
<title>string function</title>
</head>
<body>
<?php
echo "String Function"
?>
</body>
</html>
Output:
String Function
//echo is not actually function so we are not required to use
parentheses with it.
2. strtolower: It converts a string to lower case letter.
Example:
<!doctype <!DOCTYPE html>
<html>
<head>
<title>string function</title>
</head>
<body>
<?php
echo strtolower("STRING Function") ;
?>
</body>
</html>
Output:
string function
3. strtoupper ( ): It converts a string to upper case
letter.
Example:
<!doctype <!DOCTYPE html>
<html>
<head>
<title>string function</title>
</head>
<body>
<?php
echo strtoupper("String Function") ;
?>
</body>
</html>
Output:
STRING FUNCTION
4. lcfirst( ): It converts the first character of a string to
lower.
Example:
<!doctype <!DOCTYPE html>
<html>
<head>
<title>string function</title>
</head>
<body>
<?php
echo lcfirst("String Function") ;
?>
</body>
</html>
Output:
string Function
5. ucfirst( ): It converts the first character of a string
to upper case.
Example:
<!doctype <!DOCTYPE html>
<html>
<head>
<title>string function</title>
</head>
<body>
<?php
echo ucfirst("string function") ;
?>
</body>
</html>
Output:
String function
6. ucwords( ): It converts the first character of every
word to upper case.
Example:
<!doctype <!DOCTYPE html>
<html>
<head>
<title>string function</title>
</head>
<body>
<?php
echo ucwords("string function") ;
?>
</body>
</html>
Output:
String Function
7. substr_replace( ): It replaces a part of a string
with another string.
The syntax is:
Substr_replace (string, replacement, start , length)
There are various way to replace string. Here the
examples are –
Example:
<!doctype <!DOCTYPE html>
<html>
<head>
<title>string function</title>
</head>
<body>
<?php
echo substr_replace("hello world","nandon",6);
?>
</body>
</html>
Output:
hello nandon
//here it replace world to nandon . Number 6 means the
replacement starts from 6 position of the string.
Example 2:
<!doctype <!DOCTYPE html>
<html>
<head>
<title>string function</title>
</head>
<body>
<?php
echo substr_replace("hello world", "nandon",-5);
?>
</body>
</html>
Output:
hello nandon
//here in this example we use (-) negative sign so it will
count the word from the right hand side and replace.
Contact for PHP Training:
ADMEC MULTIMEDIA INSTITUTE
C-7/114, IInd Floor, Sector- 7, Rohini, Delhi- 85
Landmark: Near Rohini East Metro Station
Helpline 1: +91 9811 818 122
Helpline 2: +91 9911 782 350
ADMEC MULTIMEDIA
Leader in Animation & Digital Media Education
ISO 9001:2008 CERTIFIED | ADOBE Testing Center
ADMEC MULTIMEDIA INSTITUTE
For More information you can visit :
http://www.admecindia.co.in

More Related Content

PPSX
JDBC: java DataBase connectivity
PPTX
PHP FUNCTIONS
PPT
Class 5 - PHP Strings
PPT
PHP variables
PPTX
Php basics
PPTX
Introduction to php
PPT
Php forms
JDBC: java DataBase connectivity
PHP FUNCTIONS
Class 5 - PHP Strings
PHP variables
Php basics
Introduction to php
Php forms

What's hot (20)

PPT
PHP - Introduction to PHP Fundamentals
PDF
GET and POST in PHP
PPTX
Java Data Types
PPT
PHP - Introduction to Object Oriented Programming with PHP
PPTX
for loop in java
PPTX
Operators php
PPTX
Polymorphism presentation in java
PPTX
Files in php
PPTX
Java script
PPTX
Java abstract class & abstract methods
PPT
Oops concepts in php
PPT
Servlet life cycle
PPTX
Control statements in java
PPTX
Css selectors
PPT
Introduction to PHP.ppt
PPTX
HTML Forms
PDF
4.2 PHP Function
PDF
JavaScript - Chapter 11 - Events
PHP - Introduction to PHP Fundamentals
GET and POST in PHP
Java Data Types
PHP - Introduction to Object Oriented Programming with PHP
for loop in java
Operators php
Polymorphism presentation in java
Files in php
Java script
Java abstract class & abstract methods
Oops concepts in php
Servlet life cycle
Control statements in java
Css selectors
Introduction to PHP.ppt
HTML Forms
4.2 PHP Function
JavaScript - Chapter 11 - Events
Ad

Viewers also liked (20)

PPT
Php Presentation
PPSX
Php string
PPT
Php Ppt
PPT
PPT
Introduction to PHP
PPTX
String Manipulation in PHP
PDF
Introduction to PHP
PPTX
PHP Powerpoint -- Teach PHP with this
PPT
Functions in php
PPTX
Cookie and session
PPT
Beginners PHP Tutorial
PPT
PHP Project PPT
PDF
Php tutorial
PDF
PHP Basic & Arrays
PPT
PHP Regular Expressions
PPT
Error reporting in php
PPTX
Array in php
PPT
03 Php Array String Functions
PPT
PHP - Introduction to String Handling
Php Presentation
Php string
Php Ppt
Introduction to PHP
String Manipulation in PHP
Introduction to PHP
PHP Powerpoint -- Teach PHP with this
Functions in php
Cookie and session
Beginners PHP Tutorial
PHP Project PPT
Php tutorial
PHP Basic & Arrays
PHP Regular Expressions
Error reporting in php
Array in php
03 Php Array String Functions
PHP - Introduction to String Handling
Ad

Similar to Php string function (20)

PDF
Programming in PHP Course Material BCA 6th Semester
PPTX
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
PPTX
UNIT II (7).pptx
PPTX
UNIT II (7).pptx
PPSX
Php and MySQL
DOCX
Basic php 5
PPTX
introduction to server-side scripting
PDF
Vb script tutorial for qtp[1]
PDF
Web Development Course: PHP lecture 1
DOC
PHP MATERIAL
PDF
Web Design EJ3
PPTX
TEMPLATES IN JAVA
PPTX
모던자바의 역습
PDF
PHP Lec 2.pdfsssssssssssssssssssssssssss
PPTX
String variable in php
PDF
&lt;img src="../i/r_14.png" />
PPTX
Javascripting.pptx
PDF
php-mysql-tutorial-part-3
Programming in PHP Course Material BCA 6th Semester
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
UNIT II (7).pptx
UNIT II (7).pptx
Php and MySQL
Basic php 5
introduction to server-side scripting
Vb script tutorial for qtp[1]
Web Development Course: PHP lecture 1
PHP MATERIAL
Web Design EJ3
TEMPLATES IN JAVA
모던자바의 역습
PHP Lec 2.pdfsssssssssssssssssssssssssss
String variable in php
&lt;img src="../i/r_14.png" />
Javascripting.pptx
php-mysql-tutorial-part-3

More from Ravi Bhadauria (20)

PDF
3 Important Terms of Post Production
PDF
Basics of Video Editing | Types of Video Editing | Video Production Process
PDF
Basics of Media | Types of Media | Units in Media | Software in Media | Color...
PPTX
History of Visual Communication | Guide to Visual Communication by ADMEC Mult...
PPTX
Elements and Principles of Design (Updated)
PDF
Top Graphic Designing Hacks to Make You a Designing Pro Today
PDF
12 Famous Typographers to Inspire You
PPTX
Sargam UI Design
PDF
Use of Shapes in Graphic Design | Psychology of Shapes by ADMEC (Updated)
PDF
UX Design Essential Theories
PPTX
Top 10 Ad Gurus
PDF
Workshop on resume, portfolio, interview
PDF
Top 10 Architecture Design Colleges in India
PDF
User interface and user experience ui ux design basics
PDF
How to create Frost Neon Effect in Photoshop?
PPTX
Top 10 design colleges and institutes of india
PPTX
Best Hollywood poster designers
PDF
Design Principles for All the Designers
PDF
Content Writing Tips for SEO
PDF
6 Great Steps to Know to Create Successful Web GUI
3 Important Terms of Post Production
Basics of Video Editing | Types of Video Editing | Video Production Process
Basics of Media | Types of Media | Units in Media | Software in Media | Color...
History of Visual Communication | Guide to Visual Communication by ADMEC Mult...
Elements and Principles of Design (Updated)
Top Graphic Designing Hacks to Make You a Designing Pro Today
12 Famous Typographers to Inspire You
Sargam UI Design
Use of Shapes in Graphic Design | Psychology of Shapes by ADMEC (Updated)
UX Design Essential Theories
Top 10 Ad Gurus
Workshop on resume, portfolio, interview
Top 10 Architecture Design Colleges in India
User interface and user experience ui ux design basics
How to create Frost Neon Effect in Photoshop?
Top 10 design colleges and institutes of india
Best Hollywood poster designers
Design Principles for All the Designers
Content Writing Tips for SEO
6 Great Steps to Know to Create Successful Web GUI

Recently uploaded (20)

PDF
Disorder of Endocrine system (1).pdfyyhyyyy
PPTX
Key-Features-of-the-SHS-Program-v4-Slides (3) PPT2.pptx
PPTX
Thinking Routines and Learning Engagements.pptx
PDF
POM_Unit1_Notes.pdf Introduction to Management #mba #bba #bcom #bballb #class...
PPSX
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
PPTX
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
PDF
FAMILY PLANNING (preventative and social medicine pdf)
PPTX
4. Diagnosis and treatment planning in RPD.pptx
PDF
GSA-Past-Papers-2010-2024-2.pdf CSS examination
PPTX
IT infrastructure and emerging technologies
PPTX
Neurological complocations of systemic disease
PPTX
Power Point PR B.Inggris 12 Ed. 2019.pptx
PDF
African Communication Research: A review
PDF
BSc-Zoology-02Sem-DrVijay-Comparative anatomy of vertebrates.pdf
DOCX
THEORY AND PRACTICE ASSIGNMENT SEMESTER MAY 2025.docx
PPTX
CHROMIUM & Glucose Tolerance Factor.pptx
PDF
Physical pharmaceutics two in b pharmacy
PPTX
Copy of ARAL Program Primer_071725(1).pptx
PDF
Diabetes Mellitus , types , clinical picture, investigation and managment
PDF
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
Disorder of Endocrine system (1).pdfyyhyyyy
Key-Features-of-the-SHS-Program-v4-Slides (3) PPT2.pptx
Thinking Routines and Learning Engagements.pptx
POM_Unit1_Notes.pdf Introduction to Management #mba #bba #bcom #bballb #class...
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
FAMILY PLANNING (preventative and social medicine pdf)
4. Diagnosis and treatment planning in RPD.pptx
GSA-Past-Papers-2010-2024-2.pdf CSS examination
IT infrastructure and emerging technologies
Neurological complocations of systemic disease
Power Point PR B.Inggris 12 Ed. 2019.pptx
African Communication Research: A review
BSc-Zoology-02Sem-DrVijay-Comparative anatomy of vertebrates.pdf
THEORY AND PRACTICE ASSIGNMENT SEMESTER MAY 2025.docx
CHROMIUM & Glucose Tolerance Factor.pptx
Physical pharmaceutics two in b pharmacy
Copy of ARAL Program Primer_071725(1).pptx
Diabetes Mellitus , types , clinical picture, investigation and managment
Horaris_Grups_25-26_Definitiu_15_07_25.pdf

Php string function

  • 1. PHP String Function ADMEC MULTIMEDIA Leader in Animation & Digital Media Education ISO 9001:2008 CERTIFIED | ADOBE Testing Center www.admecindia.co.in
  • 2. PHP string function helps us to manipulate string in various ways. There are various types of string function available. Here we discuss some important functions and its use with examples. 1.echo 2.strtolower ( ) 3.strtoupper ( ) 4.lcfirst() 5.ucfirst() 6.ucwords() 7.substr_replace ( )
  • 3. 1. echo: It is used to print one or more string .Echo function is faster than print print function. Example: <!doctype <!DOCTYPE html> <html> <head> <title>string function</title> </head> <body> <?php echo "String Function" ?> </body> </html> Output: String Function //echo is not actually function so we are not required to use parentheses with it.
  • 4. 2. strtolower: It converts a string to lower case letter. Example: <!doctype <!DOCTYPE html> <html> <head> <title>string function</title> </head> <body> <?php echo strtolower("STRING Function") ; ?> </body> </html> Output: string function
  • 5. 3. strtoupper ( ): It converts a string to upper case letter. Example: <!doctype <!DOCTYPE html> <html> <head> <title>string function</title> </head> <body> <?php echo strtoupper("String Function") ; ?> </body> </html> Output: STRING FUNCTION
  • 6. 4. lcfirst( ): It converts the first character of a string to lower. Example: <!doctype <!DOCTYPE html> <html> <head> <title>string function</title> </head> <body> <?php echo lcfirst("String Function") ; ?> </body> </html> Output: string Function
  • 7. 5. ucfirst( ): It converts the first character of a string to upper case. Example: <!doctype <!DOCTYPE html> <html> <head> <title>string function</title> </head> <body> <?php echo ucfirst("string function") ; ?> </body> </html> Output: String function
  • 8. 6. ucwords( ): It converts the first character of every word to upper case. Example: <!doctype <!DOCTYPE html> <html> <head> <title>string function</title> </head> <body> <?php echo ucwords("string function") ; ?> </body> </html> Output: String Function
  • 9. 7. substr_replace( ): It replaces a part of a string with another string. The syntax is: Substr_replace (string, replacement, start , length) There are various way to replace string. Here the examples are – Example: <!doctype <!DOCTYPE html> <html> <head> <title>string function</title> </head> <body> <?php echo substr_replace("hello world","nandon",6); ?> </body> </html>
  • 10. Output: hello nandon //here it replace world to nandon . Number 6 means the replacement starts from 6 position of the string. Example 2: <!doctype <!DOCTYPE html> <html> <head> <title>string function</title> </head> <body> <?php echo substr_replace("hello world", "nandon",-5); ?> </body> </html> Output: hello nandon //here in this example we use (-) negative sign so it will count the word from the right hand side and replace.
  • 11. Contact for PHP Training: ADMEC MULTIMEDIA INSTITUTE C-7/114, IInd Floor, Sector- 7, Rohini, Delhi- 85 Landmark: Near Rohini East Metro Station Helpline 1: +91 9811 818 122 Helpline 2: +91 9911 782 350 ADMEC MULTIMEDIA Leader in Animation & Digital Media Education ISO 9001:2008 CERTIFIED | ADOBE Testing Center ADMEC MULTIMEDIA INSTITUTE For More information you can visit : http://www.admecindia.co.in