Search

Showing 7 of 1,216 result(s)

/blog/2017/12/06/laravel-5-string-helpers-replacing-the-first-occurrence-of-a-value#content-example-use

The following examples highlight the basic usage of the replaceFirst method. The results of the method call will appear above the call as a comment.

/blog/2017/12/06/laravel-5-string-helpers-replacing-the-first-occurrence-of-a-value#content-global-strreplacefirst-helper-function

The str_replace_first function is a shortcut to calling Str::replaceFirst . This function is declared in the global namespace.

/blog/2017/12/06/laravel-5-string-helpers-replacing-the-last-occurrence-of-a-value#content-signature

The following examples highlight the basic usage of the replaceLast method. The results of the method call will appear above the call as a comment.

/blog/2017/12/06/laravel-5-string-helpers-replacing-the-last-occurrence-of-a-value#content-global-strreplacelast-helper-function

The str_replace_last function is a shortcut to calling Str::replaceLast . This function is declared in the global namespace.

/blog/2017/12/06/laravel-5-string-helpers-uppercasing-the-first-word-of-a-value#content-example-use

We can combine this with PHP's built in range function for a simple way to check if a string ends in any alphabetical character:

/blog/2017/12/06/laravel-5-string-helpers-uppercasing-the-first-word-of-a-value#content-global-endswith-helper-function

The ends_with function is a shortcut to calling Str::endsWith . This function is declared in the global namespace.