3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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)); } 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", 0, 60), 'Les french demoiselles'));
Output for 7.0.0
Parse error: syntax error, unexpected ';', expecting ',' or ')' in /in/kuNfZ on line 16
Process exited with code 255.
Output for 5.3.20 - 5.6.16
Parse error: syntax error, unexpected ';' in /in/kuNfZ on line 16
Process exited with code 255.