CKTIS / PHP
ucwords()
Uppercase an ASCII lowercase letter at the beginning or immediately after a listed separator.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
ucwords(string $string, string $separators = " \t\r\n\f\v"): stringUppercase an ASCII lowercase letter at the beginning or immediately after a listed separator. Other letters keep their case. A custom separator set replaces the default whitespace set; it is not a word delimiter pattern or a Unicode title-case algorithm.
Signature
ucwords(string $string, string $separators = " \t\r\n\f\v"): string
Example output
["Red-blue Sky","Red-Blue sky","MIXed"]
Examples
<?php
echo json_encode([ucwords("red-blue sky"),ucwords("red-blue sky","-"),ucwords("mIXed")]);
Result
["Red-blue Sky","Red-Blue sky","MIXed"]