There are many times when we need to do more complex processing with strings. PHP provides us with the instructions we need to verify and manipulate strings. In this hands-on lab, you will continue learning about processing strings in PHP. But let’s go a step further and build a string processing utility plugin.
You will need to process strings when building websites. Checking for things like:
- does a string start or end with a character or substring
- does a substring exist
These are common string handling functions. In addition, you’ll need to truncate to a certain number of words or characters, join an array of strings, split strings, and more.
Instead of hunting around for the functionality that you need, let’s build a plugin with that functionality. Then you can use it on every project…over and over again.
Keep It Simple, Stupid (KISS) - the best kiss you'll get in code.
Total Lab Runtime: 01:58:54
- 1 Lab Introductionfree 03:24
- 2 Checking if String Starts With a Character or Substringpro 13:43
- 3 Explaining the "String Starts With" Strategypro 13:35
- 4 Check if String Ends With a Character or Substring - Part 1pro 15:11
- 5 Check if String Ends With a Character or Substring - Part 2pro 12:52
- 6 Has Substringpro 04:27
- 7 Truncate by Characterspro 17:18
- 8 Truncate by Wordspro 14:35
- 9 Converting to Lowercasepro 07:58
- 10 Converting to Uppercasepro 01:30
- 11 Splitting a String into An Arraypro 07:17
- 12 Joining Array Elements into a Stringpro 03:43
- 13 Wrap it Uppro 03:21
There are times when you need to control the PHP output buffer. Shortcodes are a good example of when you want to capture the buffer and return it to WordPress instead of sending it out to the browser. In this hands-on lab, you will dive into the functionality available to you for the PHP output control.
Check out the PHP Library for more hands-on labs, insights, Docx, and more.