SlideShare a Scribd company logo
Presentation on php string function part-1
php string function()
 Strip whitespace (or other characters) from the beginning and end of a
string.
<?php
$str = ‘hello Bangladesh';
echo trim($str,’h’);
?>
 Output
ello Banglades
 The rtrim() function removes whitespace or other predefined characters
from the right side of a string.

<?php
$str = "Hello World!";
echo $str . "<br>";
echo rtrim($str,"World!");
?>
Output:
 Hello World!
Hello
 Removes whitespace or other characters from the left side of a string

<?php
$str = "Hello World!";
echo $str . "<br>";
echo ltrim($str,"Hello");
?>
 Output:
 Hello World!
World!
 Removes whitespace or other characters from the right end of a string.
<?php
$str = 'Bangladesh is a wonderful country';
echo chop($str,'country');
?>
 Output:
 Bangladesh is a wonderful
 Calculates the MD5 hash of a string.
<?php
$str = 'Hello';
echo md5($str);
?>
 Output:
 8b1a9953c4611296a827abf8c47804d7
 Binary format.
<?php
$str = 'hello123';
echo md5($str,true);
?>
 Output:
 � ��b�(�@|T�k�'
 Alias of implode().
<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo join(" ",$arr);
?>
Output:
Hello World! Beautiful Day!
 Converts some predefined characters to HTML entities.
<?php
$str = "This is some <b>bold</b> text.
echo htmlspecialchars($str);
?>
 Output:
 This is some <b>bold</b> text.
 Inserts HTML line breaks in front of each new line in a string.
<?php
echo nl2br("One line.nAnother line.nLine Numbet 3");
?>
Output:
One line.
Another line.
Line Numbet 3
Presentation on php string function part-1

More Related Content

What's hot (18)

PPTX
PHP PPT FILE
AbhishekSharma2958
 
PPTX
Phphacku iitd
Sorabh Jain
 
PDF
2014 database - course 2 - php
Hung-yu Lin
 
PPT
Fantom and Tales
kaushik_sathupadi
 
PDF
PHP object calisthenics
Giorgio Cefaro
 
KEY
Using PHP
Mark Casias
 
PDF
Text in search queries with examples in Perl 6
Andrew Shitov
 
PPTX
PHP Functions & Arrays
Henry Osborne
 
PDF
Learning Perl 6
brian d foy
 
PPT
Class 5 - PHP Strings
Ahmed Swilam
 
PPTX
Introduction in php
Bozhidar Boshnakov
 
KEY
An introduction to Ruby
Wes Oldenbeuving
 
PPTX
Substitution Cipher
Agung Julisman
 
PDF
Advanced modulinos trial
brian d foy
 
PDF
Crafting Custom Interfaces with Sub::Exporter
Ricardo Signes
 
PDF
perl-pocket
tutorialsruby
 
PDF
An Introduction to PHP... and Why It's Yucky!
Jorge Silva Jetter
 
TXT
My shell
Ahmed Salah
 
PHP PPT FILE
AbhishekSharma2958
 
Phphacku iitd
Sorabh Jain
 
2014 database - course 2 - php
Hung-yu Lin
 
Fantom and Tales
kaushik_sathupadi
 
PHP object calisthenics
Giorgio Cefaro
 
Using PHP
Mark Casias
 
Text in search queries with examples in Perl 6
Andrew Shitov
 
PHP Functions & Arrays
Henry Osborne
 
Learning Perl 6
brian d foy
 
Class 5 - PHP Strings
Ahmed Swilam
 
Introduction in php
Bozhidar Boshnakov
 
An introduction to Ruby
Wes Oldenbeuving
 
Substitution Cipher
Agung Julisman
 
Advanced modulinos trial
brian d foy
 
Crafting Custom Interfaces with Sub::Exporter
Ricardo Signes
 
perl-pocket
tutorialsruby
 
An Introduction to PHP... and Why It's Yucky!
Jorge Silva Jetter
 
My shell
Ahmed Salah
 

Similar to Presentation on php string function part-1 (20)

PPTX
strings in php how to use different data types in string
vishal choudhary
 
PPTX
php string part 3
monikadeshmane
 
PDF
String functions
Nikul Shah
 
PPTX
UNIT II (7).pptx
DrDhivyaaCRAssistant
 
PPTX
UNIT II (7).pptx
DrDhivyaaCRAssistant
 
PPTX
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
Dhivyaa C.R
 
PPTX
PHP string-part 1
monikadeshmane
 
PPTX
Tokens in php (php: Hypertext Preprocessor).pptx
BINJAD1
 
ODP
PHP Web Programming
Muthuselvam RS
 
PPTX
String variable in php
chantholnet
 
PPT
9780538745840 ppt ch03
Terry Yoast
 
PPTX
Text and Numbers (Data Types)in PHP
Kamal Acharya
 
PDF
php_string.pdf
Sharon Manmothe
 
PPTX
Php string function
Ravi Bhadauria
 
PPT
String functions and operations
Mudasir Syed
 
PPTX
php string-part 2
monikadeshmane
 
DOCX
Regular expressionfunction
ADARSH BHATT
 
PPT
Manipulating strings
Nicole Ryan
 
PPT
String functions and operations
Mudasir Syed
 
strings in php how to use different data types in string
vishal choudhary
 
php string part 3
monikadeshmane
 
String functions
Nikul Shah
 
UNIT II (7).pptx
DrDhivyaaCRAssistant
 
UNIT II (7).pptx
DrDhivyaaCRAssistant
 
String handling and arrays by Dr.C.R.Dhivyaa Kongu Engineering College
Dhivyaa C.R
 
PHP string-part 1
monikadeshmane
 
Tokens in php (php: Hypertext Preprocessor).pptx
BINJAD1
 
PHP Web Programming
Muthuselvam RS
 
String variable in php
chantholnet
 
9780538745840 ppt ch03
Terry Yoast
 
Text and Numbers (Data Types)in PHP
Kamal Acharya
 
php_string.pdf
Sharon Manmothe
 
Php string function
Ravi Bhadauria
 
String functions and operations
Mudasir Syed
 
php string-part 2
monikadeshmane
 
Regular expressionfunction
ADARSH BHATT
 
Manipulating strings
Nicole Ryan
 
String functions and operations
Mudasir Syed
 
Ad

Recently uploaded (20)

PPTX
Automatic_Iperf_Log_Result_Excel_visual_v2.pptx
Chen-Chih Lee
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 41
utfefguu
 
PPTX
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
 
PDF
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
PDF
From Chaos to Clarity: Mastering Analytics Governance in the Modern Enterprise
Wiiisdom
 
PDF
65811_Introducing the Fusion AI Agent Studio (1).pdf
g6129590
 
PPTX
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
 
PPTX
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
 
PDF
LPS25 - Operationalizing MLOps in GEP - Terradue.pdf
terradue
 
PDF
Continouous failure - Why do we make our lives hard?
Papp Krisztián
 
PDF
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
PDF
Designing Accessible Content Blocks (1).pdf
jaclynmennie1
 
PPTX
computer forensics encase emager app exp6 1.pptx
ssuser343e92
 
PPTX
Mistakes to Avoid When Selecting Policy Management Software
Insurance Tech Services
 
PDF
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PDF
Power BI vs Tableau vs Looker - Which BI Tool is Right for You?
MagnusMinds IT Solution LLP
 
PPTX
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
 
PPTX
NeuroStrata: Harnessing Neuro-Symbolic Paradigms for Improved Testability and...
Ivan Ruchkin
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Automatic_Iperf_Log_Result_Excel_visual_v2.pptx
Chen-Chih Lee
 
IDM Crack with Internet Download Manager 6.42 Build 41
utfefguu
 
ManageIQ - Sprint 264 Review - Slide Deck
ManageIQ
 
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
From Chaos to Clarity: Mastering Analytics Governance in the Modern Enterprise
Wiiisdom
 
65811_Introducing the Fusion AI Agent Studio (1).pdf
g6129590
 
Android Notifications-A Guide to User-Facing Alerts in Android .pptx
Nabin Dhakal
 
Iobit Driver Booster Pro 12 Crack Free Download
chaudhryakashoo065
 
LPS25 - Operationalizing MLOps in GEP - Terradue.pdf
terradue
 
Continouous failure - Why do we make our lives hard?
Papp Krisztián
 
capitulando la keynote de GrafanaCON 2025 - Madrid
Imma Valls Bernaus
 
Designing Accessible Content Blocks (1).pdf
jaclynmennie1
 
computer forensics encase emager app exp6 1.pptx
ssuser343e92
 
Mistakes to Avoid When Selecting Policy Management Software
Insurance Tech Services
 
IObit Uninstaller Pro 14.3.1.8 Crack for Windows Latest
utfefguu
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Power BI vs Tableau vs Looker - Which BI Tool is Right for You?
MagnusMinds IT Solution LLP
 
ERP - FICO Presentation BY BSL BOKARO STEEL LIMITED.pptx
ravisranjan
 
NeuroStrata: Harnessing Neuro-Symbolic Paradigms for Improved Testability and...
Ivan Ruchkin
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Ad

Presentation on php string function part-1

  • 3.  Strip whitespace (or other characters) from the beginning and end of a string. <?php $str = ‘hello Bangladesh'; echo trim($str,’h’); ?>  Output ello Banglades
  • 4.  The rtrim() function removes whitespace or other predefined characters from the right side of a string.  <?php $str = "Hello World!"; echo $str . "<br>"; echo rtrim($str,"World!"); ?> Output:  Hello World! Hello
  • 5.  Removes whitespace or other characters from the left side of a string  <?php $str = "Hello World!"; echo $str . "<br>"; echo ltrim($str,"Hello"); ?>  Output:  Hello World! World!
  • 6.  Removes whitespace or other characters from the right end of a string. <?php $str = 'Bangladesh is a wonderful country'; echo chop($str,'country'); ?>  Output:  Bangladesh is a wonderful
  • 7.  Calculates the MD5 hash of a string. <?php $str = 'Hello'; echo md5($str); ?>  Output:  8b1a9953c4611296a827abf8c47804d7
  • 8.  Binary format. <?php $str = 'hello123'; echo md5($str,true); ?>  Output:  � ��b�(�@|T�k�'
  • 9.  Alias of implode(). <?php $arr = array('Hello','World!','Beautiful','Day!'); echo join(" ",$arr); ?> Output: Hello World! Beautiful Day!
  • 10.  Converts some predefined characters to HTML entities. <?php $str = "This is some <b>bold</b> text. echo htmlspecialchars($str); ?>  Output:  This is some <b>bold</b> text.
  • 11.  Inserts HTML line breaks in front of each new line in a string. <?php echo nl2br("One line.nAnother line.nLine Numbet 3"); ?> Output: One line. Another line. Line Numbet 3