3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "mozzzaaaaaarelaaaaaa"; $string = preg_replace('/^-+/','',$string); echo $string; function setString($phrase, $length = null) { $result = strtolower($phrase); $result = trim(preg_replace("/[^0-9a-zA-Z-]/", "-", $result)); $result = preg_replace("/--+/", "-", $result); $result = !empty($length) ? substr($result, 0, $length) : $result; // remove hyphen from the beginning (if exists) $first_char = substr($result, 0, 1); $result = $first_char == "-" ? substr($result, 1) : $result; // remove hyphen from the end (if exists) $last_char = substr($result, -1); $result = $last_char == "-" ? substr($result, 0, -1) : $result; return $result; } echo setString($string);
Output for git.master, git.master_jit, rfc.property-hooks
mozzzaaaaaarelaaaaaamozzzaaaaaarelaaaaaa

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:
44.91 ms | 401 KiB | 8 Q