PHPverse 2025

Voting

: min(six, three)?
(Example: nine)

The Note You're Voting On

Ukio
9 years ago
Maybe it help someone.
Make up case with first char, low case for other.

<?php
function str_split_unicode($str, $l = 0) {
if (
$l > 0) {
$ret = array();
$len = mb_strlen($str, "UTF-8");
for (
$i = 0; $i < $len; $i += $l) {
$ret[] = mb_substr($str, $i, $l, "UTF-8");
}
return
$ret;
}
return
preg_split("//u", $str, -1, PREG_SPLIT_NO_EMPTY);
}

function
ToCorrectCase($str){

$str = mb_strtolower($str);
$str_array = str_split_unicode($str);
$str_array[0] = mb_strtoupper($str_array[0]);
$str = '';
foreach (
$str_array as $key){
$str = $str.$key;
}
return
$str;
}
?>

<< Back to user notes page

To Top