3v4l.org

run code in 300+ PHP versions simultaneously
<?php function formatTitle($sku, $name, $brand, $maximumLength = 100) { $allowedLength = $maximumLength - 6 - mb_strlen($brand, 'UTF-8') - mb_strlen($sku, 'UTF-8'); if (mb_strlen($name) > $allowedLength) { $startLength = floor($allowedLength / 3 * 2) - 5; $name = mb_substr($name, 0, $startLength) . '[...]' . mb_substr($name, -($allowedLength - $startLength + 5)); var_dump( mb_strlen($brand, 'UTF-8'), mb_strlen($sku, 'UTF-8'), $allowedLength, $startLength, -($allowedLength - $startLength + 5) ); } return sprintf('%s | %s | %s', $sku, $name, $brand); } var_dump(strlen(formatTitle('TFT10000', substr("Lorem ipsum dolor sit amet consecutir, lorem ipsum dolor sit amet consecutir, lorem ipsum dolor sit amet consecutir, lorem ipsum dolor sit amet consecutir", 0, 100), 'Les french demoiselles')));
Output for git.master, git.master_jit, rfc.property-hooks
int(22) int(8) int(64) float(37) float(-32) int(110)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
132.31 ms | 405 KiB | 5 Q