Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Check if String Ends With a Character or Substring – Part 1
Lab: Doing More With PHP String Processing
Video Runtime: 15:11
Your next challenge is to figure out how to check for a character or substring in a given haystack (source string). Just like with the “starts with” functionality, there are a couple of different implementations. In this two-part series, you’ll explore:
- Implementation #1: Using a string position implementation
mb_strposby leveraging the offset argument to start exactly where we want.
- Implementation #2: Use the same strategy as we did with “starts with”.
We’ll walk through both implementations, talk about how they work and process, and then explore which is the better solution and why.
Break. Go rest your noodle for a couple of minutes.
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