PHP 8.4.24 Released!

Voting

: one plus four?
(Example: nine)

The Note You're Voting On

@manzoorwanijk
7 years ago
for PHP < 5.4.32 with $delimiters

function _ucwords( $str, $delimiters = " \t\r\n\f\v" ) {

    $delims = preg_split( '//u', $delimiters, -1, PREG_SPLIT_NO_EMPTY );

    foreach ( $delims as $delim ) {
        
        if ( false !== strpos( $str, $delim ) ) {

            $str = implode( $delim, array_map( 'ucfirst', explode( $delim, $str ) ) );
        }
    }

    return $str;
}

<< Back to user notes page

To Top