SlideShare une entreprise Scribd logo
Comparing two string
modification functions
Differences between behaviors of strtr() and
str_replace()
Patrick Maynard | Ixopay
PHPDAY VERONA 2024
1
About me
– Coming from the Symfony world
– Now working remotely for Ixopay, a payment orchestrator based in Vienna
– Ixopay uses Laravel, which I am still relatively new to
– We’re hiring! https://www.ixopay.com/en/company/careers
– Social media links: https://patrickmaynard.com
2
An introduction to str_replace()
– Replaces substrings, via multiple passes if needed
– Good for real-world scenarios that are unpredictable, but where regexes are
overkill
– Case-insensitive variant is str_ireplace()
3
str_replace() example one
– This example uses the method’s simple format, specifying exactly one
replacement pair.
$adjective = 'schön';
$converted = str_replace('ö', 'oe', $adjective);
//Gives us 'schoen'
4
str_replace() example two
– Can use an array to specify more complex replacements
$streetName = 'Schönwald Straße';
$originals = [ 'ä', 'ö', 'ü', 'Ä', Ö', 'Ü', 'ß'];
$replacements = ['ae', 'oe', 'ue', 'Ae', 'Oe', 'Ue', 'ss' ];
$cleaned = str_replace($originals, $replacements, $streetName);
//Gives us 'Schoenwald Strasse'
5
An introduction to strtr()
– Does ONE round of replacement, directly translating (hence the "tr") one
character or substring into another
– Has two possible input formats:
strstr(string $myString, string $from string $to)
or
strstr(string $myString, array $mappings)
– Not to be confused with strstr()
6
strtr() example one
– This example uses the simple format, specifying exactly one replacement pair.
$adjective = 'schön';
$cleaned = strtr($adjective, 'ö', 'oe');
//Gives us 'schoen'
7
strtr() example two
– The array format can work better for larger sets.
$streetName = 'Schönwald Straße';
$mappings = [ 'ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue', 'Ä' => 'Ae' => 'Ö' => 'Oe', 'Ü' =>
'Ue', 'ß' => 'ss' ];
$cleaned = strtr($streetName, $mappings);
//Gives us 'Schoenwald Strasse'
8
Differences in behavior
… so these are basically the same.
9
Differences in behavior
… so these are basically the same.
… right?
No.
If given an array of mappings,
str_replace() replaces inside the
replacements, going from left to right,
leading to sometimes counterintuitive
results. So this code …
$output = [];
$myString = 'WordOne WordTwo WordThree
WordFour WordFive WordSix';
$mappings = [
'WordOne' => 'WordTwo',
'WordTwo' => 'WordThree',
'WordThree' => 'WordFour',
'WordFour' => 'WordFive',
'WordFive' => 'WordSix',
'WordSix' => 'WordSeven'
];
$output['str_replace_results'] = str_replace(
array_keys($mappings),
array_values($mappings),
$myString);
$output['strtr_results'] = strtr($myString, $mappings);
print_r($output);
10
Differences in behavior (continued)
… yields this output:
[str_replace_results] => WordSeven WordSeven WordSeven WordSeven
WordSeven WordSeven
[strtr_results] => WordTwo WordThree WordFour WordFive WordSix
WordSeven
11
Differences in behavior (continued)
There's more.
– The str_replace() function can take in a subject array, allowing replacement of
multiple (string-formatted) array values at once in different parts of the array
12
Differences in behavior (continued)
There's more.
– The str_replace() function can take in a subject array, allowing replacement of
multiple (string-formatted) array values at once in different parts of the array
– When you do this (or even use a simple string replacement), you can also give a
fourth argument: An int variable that will be modified by reference to hold the
number of replacements performed. So, for example …
13
Differences in behavior (continued)
$result = [];
$count = 0;
$inputStringsExample = ['EUR,USD','USD,EUR'];
$abbreviations = ['EUR', 'USD'];
$acceptedCurrencies = ['Euros', 'U.S. dollars'];
$fixed = str_replace($abbreviations,
$acceptedCurrencies, $inputStringsExample,
$count);
print_r($inputStringsExample);
print $count;
… yields this output:
Array
(
[0] => EUR,USD
[1] => USD,EUR
)
4
14
Differences in behavior (continued)
You can even feed str_replace() a string for the subject and an array for the
replacement, allowing you to replace a series of identical wildcards in a document
with a sequence of ever-changing values.
(Similar to PDO parameter substitution -- but obviously use that safer, baked-in
PDO behavior instead if working with a database.)
15
Summary
– Use str_replace() with caution, as it may do multiple sequential replacements
– If that's a problem (and you don't need to count replacements), use strtr()
– If you need a count but you don't trust str_replace(), you can use strtr() twice
with a flag value
16
Thank you!
– These slides: https://www.slideshare.net/patrickmaynard3
– Ixopay careers page: https://www.ixopay.com/en/company/careers
– Social media links: https://patrickmaynard.com
17

Contenu connexe

Similaire à Comparing two string modification functions

Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
Sujith Kumar
 
Intoduction to php strings
Intoduction to php  stringsIntoduction to php  strings
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introduction
Prof. Wim Van Criekinge
 
Unit 1-array,lists and hashes
Unit 1-array,lists and hashesUnit 1-array,lists and hashes
Unit 1-array,lists and hashes
sana mateen
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
Raj Gupta
 
Unit3 C
Unit3 C Unit3 C
Unit3 C
arnold 7490
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
Simon Proctor
 
Module7
Module7Module7
Module7
Seid Hussein
 
Recursion Lecture in C++
Recursion Lecture in C++Recursion Lecture in C++
Recursion Lecture in C++
Raffi Khatchadourian
 
05a-enum.ppt
05a-enum.ppt05a-enum.ppt
05a-enum.ppt
MuthuMs8
 
Java Cheat Sheet
Java Cheat SheetJava Cheat Sheet
Java Cheat Sheet
Saeid Zebardast
 
regular-expression.pdf
regular-expression.pdfregular-expression.pdf
regular-expression.pdf
DarellMuchoko
 
Perl.predefined.variables
Perl.predefined.variablesPerl.predefined.variables
Perl.predefined.variables
King Hom
 
Php Chapter 4 Training
Php Chapter 4 TrainingPhp Chapter 4 Training
Php Chapter 4 Training
Chris Chubb
 
Array String - Web Programming
Array String - Web ProgrammingArray String - Web Programming
Array String - Web Programming
Amirul Azhar
 
Arrays in php
Arrays in phpArrays in php
Arrays in php
Laiby Thomas
 
Regular expressionfunction
Regular expressionfunctionRegular expressionfunction
Regular expressionfunction
ADARSH BHATT
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
Muthuselvam RS
 
20220112 sac v1
20220112 sac v120220112 sac v1
20220112 sac v1
Sharon Liu
 

Similaire à Comparing two string modification functions (20)

Regular expressions in Python
Regular expressions in PythonRegular expressions in Python
Regular expressions in Python
 
Intoduction to php strings
Intoduction to php  stringsIntoduction to php  strings
Intoduction to php strings
 
Bioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introductionBioinformatica 06-10-2011-p2 introduction
Bioinformatica 06-10-2011-p2 introduction
 
Unit 1-array,lists and hashes
Unit 1-array,lists and hashesUnit 1-array,lists and hashes
Unit 1-array,lists and hashes
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Unit3 C
Unit3 C Unit3 C
Unit3 C
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Perl6 a whistle stop tour
Perl6 a whistle stop tourPerl6 a whistle stop tour
Perl6 a whistle stop tour
 
Module7
Module7Module7
Module7
 
Recursion Lecture in C++
Recursion Lecture in C++Recursion Lecture in C++
Recursion Lecture in C++
 
05a-enum.ppt
05a-enum.ppt05a-enum.ppt
05a-enum.ppt
 
Java Cheat Sheet
Java Cheat SheetJava Cheat Sheet
Java Cheat Sheet
 
regular-expression.pdf
regular-expression.pdfregular-expression.pdf
regular-expression.pdf
 
Perl.predefined.variables
Perl.predefined.variablesPerl.predefined.variables
Perl.predefined.variables
 
Php Chapter 4 Training
Php Chapter 4 TrainingPhp Chapter 4 Training
Php Chapter 4 Training
 
Array String - Web Programming
Array String - Web ProgrammingArray String - Web Programming
Array String - Web Programming
 
Arrays in php
Arrays in phpArrays in php
Arrays in php
 
Regular expressionfunction
Regular expressionfunctionRegular expressionfunction
Regular expressionfunction
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
20220112 sac v1
20220112 sac v120220112 sac v1
20220112 sac v1
 

Dernier

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
jpupo2018
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 

Dernier (20)

Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 

Comparing two string modification functions

  • 1. Comparing two string modification functions Differences between behaviors of strtr() and str_replace() Patrick Maynard | Ixopay PHPDAY VERONA 2024 1
  • 2. About me – Coming from the Symfony world – Now working remotely for Ixopay, a payment orchestrator based in Vienna – Ixopay uses Laravel, which I am still relatively new to – We’re hiring! https://www.ixopay.com/en/company/careers – Social media links: https://patrickmaynard.com 2
  • 3. An introduction to str_replace() – Replaces substrings, via multiple passes if needed – Good for real-world scenarios that are unpredictable, but where regexes are overkill – Case-insensitive variant is str_ireplace() 3
  • 4. str_replace() example one – This example uses the method’s simple format, specifying exactly one replacement pair. $adjective = 'schön'; $converted = str_replace('ö', 'oe', $adjective); //Gives us 'schoen' 4
  • 5. str_replace() example two – Can use an array to specify more complex replacements $streetName = 'Schönwald Straße'; $originals = [ 'ä', 'ö', 'ü', 'Ä', Ö', 'Ü', 'ß']; $replacements = ['ae', 'oe', 'ue', 'Ae', 'Oe', 'Ue', 'ss' ]; $cleaned = str_replace($originals, $replacements, $streetName); //Gives us 'Schoenwald Strasse' 5
  • 6. An introduction to strtr() – Does ONE round of replacement, directly translating (hence the "tr") one character or substring into another – Has two possible input formats: strstr(string $myString, string $from string $to) or strstr(string $myString, array $mappings) – Not to be confused with strstr() 6
  • 7. strtr() example one – This example uses the simple format, specifying exactly one replacement pair. $adjective = 'schön'; $cleaned = strtr($adjective, 'ö', 'oe'); //Gives us 'schoen' 7
  • 8. strtr() example two – The array format can work better for larger sets. $streetName = 'Schönwald Straße'; $mappings = [ 'ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue', 'Ä' => 'Ae' => 'Ö' => 'Oe', 'Ü' => 'Ue', 'ß' => 'ss' ]; $cleaned = strtr($streetName, $mappings); //Gives us 'Schoenwald Strasse' 8
  • 9. Differences in behavior … so these are basically the same. 9
  • 10. Differences in behavior … so these are basically the same. … right? No. If given an array of mappings, str_replace() replaces inside the replacements, going from left to right, leading to sometimes counterintuitive results. So this code … $output = []; $myString = 'WordOne WordTwo WordThree WordFour WordFive WordSix'; $mappings = [ 'WordOne' => 'WordTwo', 'WordTwo' => 'WordThree', 'WordThree' => 'WordFour', 'WordFour' => 'WordFive', 'WordFive' => 'WordSix', 'WordSix' => 'WordSeven' ]; $output['str_replace_results'] = str_replace( array_keys($mappings), array_values($mappings), $myString); $output['strtr_results'] = strtr($myString, $mappings); print_r($output); 10
  • 11. Differences in behavior (continued) … yields this output: [str_replace_results] => WordSeven WordSeven WordSeven WordSeven WordSeven WordSeven [strtr_results] => WordTwo WordThree WordFour WordFive WordSix WordSeven 11
  • 12. Differences in behavior (continued) There's more. – The str_replace() function can take in a subject array, allowing replacement of multiple (string-formatted) array values at once in different parts of the array 12
  • 13. Differences in behavior (continued) There's more. – The str_replace() function can take in a subject array, allowing replacement of multiple (string-formatted) array values at once in different parts of the array – When you do this (or even use a simple string replacement), you can also give a fourth argument: An int variable that will be modified by reference to hold the number of replacements performed. So, for example … 13
  • 14. Differences in behavior (continued) $result = []; $count = 0; $inputStringsExample = ['EUR,USD','USD,EUR']; $abbreviations = ['EUR', 'USD']; $acceptedCurrencies = ['Euros', 'U.S. dollars']; $fixed = str_replace($abbreviations, $acceptedCurrencies, $inputStringsExample, $count); print_r($inputStringsExample); print $count; … yields this output: Array ( [0] => EUR,USD [1] => USD,EUR ) 4 14
  • 15. Differences in behavior (continued) You can even feed str_replace() a string for the subject and an array for the replacement, allowing you to replace a series of identical wildcards in a document with a sequence of ever-changing values. (Similar to PDO parameter substitution -- but obviously use that safer, baked-in PDO behavior instead if working with a database.) 15
  • 16. Summary – Use str_replace() with caution, as it may do multiple sequential replacements – If that's a problem (and you don't need to count replacements), use strtr() – If you need a count but you don't trust str_replace(), you can use strtr() twice with a flag value 16
  • 17. Thank you! – These slides: https://www.slideshare.net/patrickmaynard3 – Ixopay careers page: https://www.ixopay.com/en/company/careers – Social media links: https://patrickmaynard.com 17

Notes de l'éditeur

  1. https://docs.google.com/document/d/1pJwiabIbb_R3DgoOwqhOm1Ouq_IqioDnkLDmyD0x4SI/edit