Join David Powers for an in-depth discussion in this video Multiple string replacement and SVGs, part of PHP Tips, Tricks, and Techniques.
- [Instructor] Hi, I'm David Powers,…and welcome to this week's edition…of PHP Tips and Tricks, designed to help you…become a smarter, more productive PHP developer.…In this edition, I want to focus on an often overlooked…aspect of the str_replace function,…the ability to replace multiple character strings…in a single pass, and I'll use this feature…to generate data URIs for scalable vector graphics.…This is the documentation of a str_replace…in the PHP online manual.…
The function's signature shows that the data type…for the three required arguments is mixed.…This means they can either be a single string…or an array of strings.…In the case of this third argument,…the subject that's being edited,…it enables you to do a find and replace operation…on every element of an array.…Now, that's certainly useful,…but I think that much more interesting…is using arrays for the first two arguments,…for search and for replace.…Instead of finding and replacing one string…at a time, you can pass an array…of search strings as the first argument,…
Note: The exercise files are free to all members. The code is commented to enhance your learning, but you will need database connectivity for some files to run as intended.
Skill Level Intermediate
PHP: Managing Persistent Sessionswith David Powers2h 41m Intermediate
New this Week:
1. Weekly Episodes
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.