CakeFest 2025 Madrid: The Official CakePHP Conference

Voting

: max(nine, two)?
(Example: nine)

The Note You're Voting On

danieldoorduin at hotmail dot com
20 years ago
Using substr_replace() can be avoided by using substr() instead:

<?
$string = substr($string, 0, $position_needle).$replace.substr($string, $position_needle+$length_needle);
?>

This can be useful when you need to replace parts of multibyte strings like strings encoded with utf-8. There isn't a multibute variant for substr_replace(), but for php substr() there is mb_substr(). For more information on multibyte strings see http://nl3.php.net/manual/en/ref.mbstring.php

<< Back to user notes page

To Top