SlideShare a Scribd company logo
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

What's hot

Javascript operators
Javascript operatorsJavascript operators
Javascript operators
Mohit Rana
 

What's hot (20)

jQuery for beginners
jQuery for beginnersjQuery for beginners
jQuery for beginners
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 
Class 5 - PHP Strings
Class 5 - PHP StringsClass 5 - PHP Strings
Class 5 - PHP Strings
 
Php forms
Php formsPhp forms
Php forms
 
Javascript conditional statements
Javascript conditional statementsJavascript conditional statements
Javascript conditional statements
 
Php array
Php arrayPhp array
Php array
 
Java script
Java scriptJava script
Java script
 
Javascript
JavascriptJavascript
Javascript
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
JavaScript - Chapter 10 - Strings and Arrays
 JavaScript - Chapter 10 - Strings and Arrays JavaScript - Chapter 10 - Strings and Arrays
JavaScript - Chapter 10 - Strings and Arrays
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Html form tag
Html form tagHtml form tag
Html form tag
 
JavaScript - Chapter 8 - Objects
 JavaScript - Chapter 8 - Objects JavaScript - Chapter 8 - Objects
JavaScript - Chapter 8 - Objects
 
Html forms
Html formsHtml forms
Html forms
 
Javascript operators
Javascript operatorsJavascript operators
Javascript operators
 
Java Server Pages(jsp)
Java Server Pages(jsp)Java Server Pages(jsp)
Java Server Pages(jsp)
 
JavaScript - An Introduction
JavaScript - An IntroductionJavaScript - An Introduction
JavaScript - An Introduction
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
jQuery
jQueryjQuery
jQuery
 

Viewers also liked

Beginners PHP Tutorial
Beginners PHP TutorialBeginners PHP Tutorial
Beginners PHP Tutorial
alexjones89
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
Niit
 

Viewers also liked (20)

Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
Php string
Php stringPhp string
Php string
 
Php Ppt
Php PptPhp Ppt
Php Ppt
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
String Manipulation in PHP
String Manipulation in PHPString Manipulation in PHP
String Manipulation in PHP
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with thisPHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
 
Functions in php
Functions in phpFunctions in php
Functions in php
 
Cookie and session
Cookie and sessionCookie and session
Cookie and session
 
Beginners PHP Tutorial
Beginners PHP TutorialBeginners PHP Tutorial
Beginners PHP Tutorial
 
PHP Project PPT
PHP Project PPTPHP Project PPT
PHP Project PPT
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php
PhpPhp
Php
 
PHP Basic & Arrays
PHP Basic & ArraysPHP Basic & Arrays
PHP Basic & Arrays
 
PHP Regular Expressions
PHP Regular ExpressionsPHP Regular Expressions
PHP Regular Expressions
 
Error reporting in php
Error reporting in php Error reporting in php
Error reporting in php
 
Array in php
Array in phpArray in php
Array in php
 
03 Php Array String Functions
03 Php Array String Functions03 Php Array String Functions
03 Php Array String Functions
 
PHP - Introduction to String Handling
PHP -  Introduction to  String Handling PHP -  Introduction to  String Handling
PHP - Introduction to String Handling
 

Similar to Php string function

String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering CollegeString handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
Dhivyaa C.R
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
srikanthbkm
 
String variable in php
String variable in phpString variable in php
String variable in php
chantholnet
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
tutorialsruby
 
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
tutorialsruby
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
tutorialsruby
 

Similar to Php string function (20)

UNIT II (7).pptx
UNIT II (7).pptxUNIT II (7).pptx
UNIT II (7).pptx
 
UNIT II (7).pptx
UNIT II (7).pptxUNIT II (7).pptx
UNIT II (7).pptx
 
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering CollegeString handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
 
Php and MySQL
Php and MySQLPhp and MySQL
Php and MySQL
 
Basic php 5
Basic php 5Basic php 5
Basic php 5
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scripting
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
 
Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1Web Development Course: PHP lecture 1
Web Development Course: PHP lecture 1
 
PHP MATERIAL
PHP MATERIALPHP MATERIAL
PHP MATERIAL
 
Web Design EJ3
Web Design EJ3Web Design EJ3
Web Design EJ3
 
TEMPLATES IN JAVA
TEMPLATES IN JAVATEMPLATES IN JAVA
TEMPLATES IN JAVA
 
Php
PhpPhp
Php
 
모던자바의 역습
모던자바의 역습모던자바의 역습
모던자바의 역습
 
Php
PhpPhp
Php
 
String variable in php
String variable in phpString variable in php
String variable in php
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Javascripting.pptx
Javascripting.pptxJavascripting.pptx
Javascripting.pptx
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
 
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
 

More from Ravi Bhadauria

More from Ravi Bhadauria (20)

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

Recently uploaded

Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
Avinash Rai
 

Recently uploaded (20)

Research Methods in Psychology | Cambridge AS Level | Cambridge Assessment In...
Research Methods in Psychology | Cambridge AS Level | Cambridge Assessment In...Research Methods in Psychology | Cambridge AS Level | Cambridge Assessment In...
Research Methods in Psychology | Cambridge AS Level | Cambridge Assessment In...
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptxslides CapTechTalks Webinar May 2024 Alexander Perry.pptx
slides CapTechTalks Webinar May 2024 Alexander Perry.pptx
 
How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17How to Manage Notification Preferences in the Odoo 17
How to Manage Notification Preferences in the Odoo 17
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Keeping Your Information Safe with Centralized Security Services
Keeping Your Information Safe with Centralized Security ServicesKeeping Your Information Safe with Centralized Security Services
Keeping Your Information Safe with Centralized Security Services
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General QuizPragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
Pragya Champions Chalice 2024 Prelims & Finals Q/A set, General Quiz
 
How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17How to the fix Attribute Error in odoo 17
How to the fix Attribute Error in odoo 17
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
Open Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPointOpen Educational Resources Primer PowerPoint
Open Educational Resources Primer PowerPoint
 

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