SlideShare a Scribd company logo
1 of 5
PHP-Strings
A string is a sequence of characters,
like "Hello world!".
We will take a look at some
extended examples on PHP Strings.
What are strings?
What is the length of the following
string: “Suraj is cool”?
At what index does “u” start?
Write a program to find the number
of words in the line.
Reverse the string “Hello world!”.
Example 1: String Manipulation.
The PHP strpos() function searches
for a specific text within a string.
If a match is found, the function
returns the character position of
the first match. If no match is
found, it will return FALSE.
Strpos
 The PHP str_replace() function replaces some
characters with some other characters in a string.
 Replace the “word” by “hello” in the following string.
“Test Word”
Replace text within a string

More Related Content

Viewers also liked (8)

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
 
Php String And Regular Expressions
Php String  And Regular ExpressionsPhp String  And Regular Expressions
Php String And Regular Expressions
 
Php Error Handling
Php Error HandlingPhp Error Handling
Php Error Handling
 
Introduction to Java Strings, By Kavita Ganesan
Introduction to Java Strings, By Kavita GanesanIntroduction to Java Strings, By Kavita Ganesan
Introduction to Java Strings, By Kavita Ganesan
 
Data Definition and Data Manipulation Language-DDL & DML
Data Definition and Data Manipulation Language-DDL & DMLData Definition and Data Manipulation Language-DDL & DML
Data Definition and Data Manipulation Language-DDL & DML
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with thisPHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 

More from Suraj Motee

More from Suraj Motee (19)

Multimedia.pptx
Multimedia.pptxMultimedia.pptx
Multimedia.pptx
 
Compression techniques for sound
Compression techniques for soundCompression techniques for sound
Compression techniques for sound
 
Lesson 21: Compression techniques for images
Lesson 21: Compression techniques for imagesLesson 21: Compression techniques for images
Lesson 21: Compression techniques for images
 
Lesson 20: Principles of data compression
Lesson 20: Principles of data compressionLesson 20: Principles of data compression
Lesson 20: Principles of data compression
 
Lesson 18- Video & File extension
Lesson 18- Video & File extensionLesson 18- Video & File extension
Lesson 18- Video & File extension
 
Lesson 17- Representing text
Lesson 17- Representing textLesson 17- Representing text
Lesson 17- Representing text
 
Lesson 16- Vector Images
Lesson 16- Vector Images Lesson 16- Vector Images
Lesson 16- Vector Images
 
Cambridge O-Level Computer Science-2210
Cambridge O-Level Computer Science-2210Cambridge O-Level Computer Science-2210
Cambridge O-Level Computer Science-2210
 
Functions Worksheet
Functions WorksheetFunctions Worksheet
Functions Worksheet
 
Pure Mathematics 1- Functions
Pure Mathematics 1- FunctionsPure Mathematics 1- Functions
Pure Mathematics 1- Functions
 
While Loops in PHP
While Loops in PHPWhile Loops in PHP
While Loops in PHP
 
Functions in PHP
Functions in PHPFunctions in PHP
Functions in PHP
 
For loops in PHP
For loops in PHPFor loops in PHP
For loops in PHP
 
Associative arrays in PHP
Associative arrays in PHPAssociative arrays in PHP
Associative arrays in PHP
 
Operators
OperatorsOperators
Operators
 
Echo and print in PHP
Echo and print in PHPEcho and print in PHP
Echo and print in PHP
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Data types
Data typesData types
Data types
 
Variables
VariablesVariables
Variables
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

String Manipulation in PHP

  • 2. A string is a sequence of characters, like "Hello world!". We will take a look at some extended examples on PHP Strings. What are strings?
  • 3. What is the length of the following string: “Suraj is cool”? At what index does “u” start? Write a program to find the number of words in the line. Reverse the string “Hello world!”. Example 1: String Manipulation.
  • 4. The PHP strpos() function searches for a specific text within a string. If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE. Strpos
  • 5.  The PHP str_replace() function replaces some characters with some other characters in a string.  Replace the “word” by “hello” in the following string. “Test Word” Replace text within a string