SlideShare a Scribd company logo
1 of 18
 PHP String Functions
 Md. Alamgir Hossen
IECL
 The addcslashes() function returns a string with backslashes
in front of the specified characters.
$str = "Welcome to my humble Homepage!";
echo addcslashes($str,'m')."<br>";
echo addcslashes($str,a..z')."<br>";
 Output
Welcome to my humble Homepage!
Welcome to my humble Homepage!
 Returns a string with backslashes in front of predefined
characters

$str = "Is your name O'Reilly?";
echo addslashes($str);
 Outputs:
 Is your name O'Reilly?
 Breaks a string into an array
 $myStr = "We are lerning PHP"; delimiter
 print_r (explode(" " ,$myStr)); source string
 output
 Array (
 [0] => We
 [1] => are
 [2] => lerning
 [3] => PHP
)
 $myStr = "We are lerning PHP";
 $str = explode(" ",$myStr);
 echo $str[0]. " ". $str[1] ." ".$str[2]." ".$str[3];
 Output:
 We are lerning PHP

 $myStr = "We,are,lerning,PHP";
 print_r(explode(",",$myStr,-3));
 Output:
 ???
 Returns a string from the elements of an array
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(',', $arr);
Output:
Hello,World!,Beautiful,Day!
<?php
$city = array("Dhaka", "Chittagong", "Rajshahi","Sylet",
"Khulna", "Barishal");
$checker = is_array($city);
var_dump($checker);
echo $checker;
?>
 Output:
bool(true)
1
<?php
$ arrayList = array('HTML','CSS','PHP');
echo count($arrayList);
?>
Output:
3
$country = array(
"Asia" => array("Bangladesh","India","Pakistan"),
"Europe" => array("England","France"),
"Africa" => array("Kenya","Libya","Somalia")
);
echo count($country,COUNT_RECURSIVE);
Output:
11
 Returns the length of a string
<?php
$strLen = 'I love php, I love php too';
echo strlen($strLen);
?>
Output:
26
<?php
$y = 'something';
$z = 'test';
$x = isset($y,$z);
var_dump($x);
?>
Output:
bool(true)
<?php
echo isset($result[0]['column_name']) ? $result[0]['column_name'] : ‘ ';
?>
() ? : ‘ ’;
<?php
echo round(9.3545,3);
?>
Output:
9.355
Converts the first character of a string to uppercase
<?php
echo ucfirst("hello world!");
?>
Output:
Hello world!
 Converts the first character of each word in a string to
uppercase
<?php
echo ucwords("hello world hello world hello world");
?>
Output:
Hello World Hello World Hello World
<?php
$x = '<h1><span>Bangladesh is a country of natural
beauty</span></h1>
<p>I love codeing</p> <h3> Alomgir </h3>‘ ;
echo strip_tags($x,'<h1><p><h3>');
?>
output:
 Bangladesh is a country of natural beauty
 I love codeing
 Alomgir
<?php
echo floor(2.5);
?>
Ouput:
2
Presentation on php string function part-2
Presentation on php string function part-2

More Related Content

What's hot

What's hot (18)

Class 2 - Introduction to PHP
Class 2 - Introduction to PHPClass 2 - Introduction to PHP
Class 2 - Introduction to PHP
 
PHP for hacks
PHP for hacksPHP for hacks
PHP for hacks
 
PHP PPT FILE
PHP PPT FILEPHP PPT FILE
PHP PPT FILE
 
Phphacku iitd
Phphacku iitdPhphacku iitd
Phphacku iitd
 
Using PHP
Using PHPUsing PHP
Using PHP
 
PHP Functions & Arrays
PHP Functions & ArraysPHP Functions & Arrays
PHP Functions & Arrays
 
Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6Text in search queries with examples in Perl 6
Text in search queries with examples in Perl 6
 
Learning Perl 6
Learning Perl 6 Learning Perl 6
Learning Perl 6
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
Fantom and Tales
Fantom and TalesFantom and Tales
Fantom and Tales
 
Crafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::ExporterCrafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::Exporter
 
Class 5 - PHP Strings
Class 5 - PHP StringsClass 5 - PHP Strings
Class 5 - PHP Strings
 
PHP object calisthenics
PHP object calisthenicsPHP object calisthenics
PHP object calisthenics
 
Introduction in php
Introduction in phpIntroduction in php
Introduction in php
 
perl-pocket
perl-pocketperl-pocket
perl-pocket
 
Substitution Cipher
Substitution CipherSubstitution Cipher
Substitution Cipher
 
My shell
My shellMy shell
My shell
 
Advanced modulinos trial
Advanced modulinos trialAdvanced modulinos trial
Advanced modulinos trial
 

Similar to Presentation on php string function part-2

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

PHP Strings and Patterns
PHP Strings and PatternsPHP Strings and Patterns
PHP Strings and Patterns
 
Php Lecture Notes
Php Lecture NotesPhp Lecture Notes
Php Lecture Notes
 
PHP_Lecture.pdf
PHP_Lecture.pdfPHP_Lecture.pdf
PHP_Lecture.pdf
 
Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)
 
Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01Barcelona.pm Curs1211 sess01
Barcelona.pm Curs1211 sess01
 
PHP-01-Overview.ppt
PHP-01-Overview.pptPHP-01-Overview.ppt
PHP-01-Overview.ppt
 
Php functions
Php functionsPhp functions
Php functions
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
PHP-Overview.ppt
PHP-Overview.pptPHP-Overview.ppt
PHP-Overview.ppt
 
tutorial7
tutorial7tutorial7
tutorial7
 
tutorial7
tutorial7tutorial7
tutorial7
 
Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3
 
P3 2018 python_regexes
P3 2018 python_regexesP3 2018 python_regexes
P3 2018 python_regexes
 
null Pune meet - Application Security: Code injection
null Pune meet - Application Security: Code injectionnull Pune meet - Application Security: Code injection
null Pune meet - Application Security: Code injection
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
 
Intoduction to php strings
Intoduction to php  stringsIntoduction to php  strings
Intoduction to php strings
 
Mysql & Php
Mysql & PhpMysql & Php
Mysql & Php
 
PHP and MySQL
PHP and MySQLPHP and MySQL
PHP and MySQL
 
Arrays in php
Arrays in phpArrays in php
Arrays in php
 

Recently uploaded

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 

Recently uploaded (20)

Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 

Presentation on php string function part-2

  • 1.  PHP String Functions
  • 2.  Md. Alamgir Hossen IECL
  • 3.  The addcslashes() function returns a string with backslashes in front of the specified characters. $str = "Welcome to my humble Homepage!"; echo addcslashes($str,'m')."<br>"; echo addcslashes($str,a..z')."<br>";  Output Welcome to my humble Homepage! Welcome to my humble Homepage!
  • 4.  Returns a string with backslashes in front of predefined characters  $str = "Is your name O'Reilly?"; echo addslashes($str);  Outputs:  Is your name O'Reilly?
  • 5.  Breaks a string into an array  $myStr = "We are lerning PHP"; delimiter  print_r (explode(" " ,$myStr)); source string  output  Array (  [0] => We  [1] => are  [2] => lerning  [3] => PHP )
  • 6.  $myStr = "We are lerning PHP";  $str = explode(" ",$myStr);  echo $str[0]. " ". $str[1] ." ".$str[2]." ".$str[3];  Output:  We are lerning PHP   $myStr = "We,are,lerning,PHP";  print_r(explode(",",$myStr,-3));  Output:  ???
  • 7.  Returns a string from the elements of an array $arr = array('Hello','World!','Beautiful','Day!'); echo implode(',', $arr); Output: Hello,World!,Beautiful,Day!
  • 8. <?php $city = array("Dhaka", "Chittagong", "Rajshahi","Sylet", "Khulna", "Barishal"); $checker = is_array($city); var_dump($checker); echo $checker; ?>  Output: bool(true) 1
  • 9. <?php $ arrayList = array('HTML','CSS','PHP'); echo count($arrayList); ?> Output: 3 $country = array( "Asia" => array("Bangladesh","India","Pakistan"), "Europe" => array("England","France"), "Africa" => array("Kenya","Libya","Somalia") ); echo count($country,COUNT_RECURSIVE); Output: 11
  • 10.  Returns the length of a string <?php $strLen = 'I love php, I love php too'; echo strlen($strLen); ?> Output: 26
  • 11. <?php $y = 'something'; $z = 'test'; $x = isset($y,$z); var_dump($x); ?> Output: bool(true) <?php echo isset($result[0]['column_name']) ? $result[0]['column_name'] : ‘ '; ?> () ? : ‘ ’;
  • 13. Converts the first character of a string to uppercase <?php echo ucfirst("hello world!"); ?> Output: Hello world!
  • 14.  Converts the first character of each word in a string to uppercase <?php echo ucwords("hello world hello world hello world"); ?> Output: Hello World Hello World Hello World
  • 15. <?php $x = '<h1><span>Bangladesh is a country of natural beauty</span></h1> <p>I love codeing</p> <h3> Alomgir </h3>‘ ; echo strip_tags($x,'<h1><p><h3>'); ?> output:  Bangladesh is a country of natural beauty  I love codeing  Alomgir