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

Class 2 - Introduction to PHP
Class 2 - Introduction to PHPClass 2 - Introduction to PHP
Class 2 - Introduction to PHP
Ahmed Swilam
 
PHP for hacks
PHP for hacksPHP for hacks
PHP for hacks
Tom Praison Praison
 
PHP PPT FILE
PHP PPT FILEPHP PPT FILE
PHP PPT FILE
AbhishekSharma2958
 
Using PHP
Using PHPUsing PHP
Using PHP
Mark Casias
 
PHP Functions & Arrays
PHP Functions & ArraysPHP Functions & Arrays
PHP Functions & Arrays
Henry Osborne
 
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
Andrew Shitov
 
Learning Perl 6
Learning Perl 6 Learning Perl 6
Learning Perl 6
brian d foy
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
Vineet Kumar Saini
 
Fantom and Tales
Fantom and TalesFantom and Tales
Fantom and Tales
kaushik_sathupadi
 
Crafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::ExporterCrafting Custom Interfaces with Sub::Exporter
Crafting Custom Interfaces with Sub::Exporter
Ricardo Signes
 
Class 5 - PHP Strings
Class 5 - PHP StringsClass 5 - PHP Strings
Class 5 - PHP Strings
Ahmed Swilam
 
PHP object calisthenics
PHP object calisthenicsPHP object calisthenics
PHP object calisthenics
Giorgio Cefaro
 
Introduction in php
Introduction in phpIntroduction in php
Introduction in php
Bozhidar Boshnakov
 
Substitution Cipher
Substitution CipherSubstitution Cipher
Substitution Cipher
Agung Julisman
 
Advanced modulinos trial
Advanced modulinos trialAdvanced modulinos trial
Advanced modulinos trial
brian d foy
 

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

PHP Strings and Patterns
PHP Strings and PatternsPHP Strings and Patterns
PHP Strings and Patterns
Henry Osborne
 
Php Lecture Notes
Php Lecture NotesPhp Lecture Notes
Php Lecture Notes
Santhiya Grace
 
PHP_Lecture.pdf
PHP_Lecture.pdfPHP_Lecture.pdf
PHP_Lecture.pdf
mysthicrious
 
Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)Learning Perl 6 (NPW 2007)
Learning Perl 6 (NPW 2007)
brian d foy
 
PHP-01-Overview.ppt
PHP-01-Overview.pptPHP-01-Overview.ppt
PHP-01-Overview.ppt
NBACriteria2SICET
 
Php functions
Php functionsPhp functions
Php functions
JIGAR MAKHIJA
 
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
David Golden
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to PerlSway Wang
 
PHP-Overview.ppt
PHP-Overview.pptPHP-Overview.ppt
PHP-Overview.ppt
Akshay Bhujbal
 
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
Mohd Harris Ahmad Jaal
 
P3 2018 python_regexes
P3 2018 python_regexesP3 2018 python_regexes
P3 2018 python_regexes
Prof. Wim Van Criekinge
 
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
n|u - The Open Security Community
 
The History of PHPersistence
The History of PHPersistenceThe History of PHPersistence
The History of PHPersistence
Hugo Hamon
 
PHP and MySQL
PHP and MySQLPHP and MySQL
PHP and MySQL
Sanketkumar Biswas
 
Arrays in php
Arrays in phpArrays in php
Arrays in php
Laiby Thomas
 

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

Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 

Recently uploaded (20)

Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 

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