Ensuring Strings Always Begin with a Specific Prefix
Learn how to ensure a string always begins with a specific prefix.
We'll cover the following
The start
helper method
It is the opposite of the finish
helper method. It ensures that the provided value always begins with some prefix. This method can be helpful when generating absolute URLs from relative paths, ensuring hierarchical blog post slugs always start with their parent slug, constructing dynamic PHP class names with namespaces, etc.
Get hands-on with 1200+ tech skills courses.