<?php
<?php
echo _cbt_webform_crop_str('sdg sdfg sgd',3);
function _cbt_webform_crop_str($string, $limit) {
if (strlen($string) >= $limit) {
$substring_limited = substr($string, 0, $limit);
return substr($substring_limited, 0, strrpos($substring_limited,' '));
}
else {
//Если количество символов строки меньше чем задано, то просто возращаем оригинал
return $string;
}
}
- Output for 5.3.0 - 5.3.22, 5.3.24, 5.4.0 - 5.4.12, 5.4.14
- Parse error: syntax error, unexpected '<' in 7Ra7A on line 2
Process exited with code 255. - Output for 5.3.23, 5.4.13
- Parse error: syntax error, unexpected '<' in /in/mNDke on line 2
Process exited with code 255.
preferences:
176.48 ms | 1386 KiB | 47 Q