3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $match = '/^@function\s+([_\-\w]+)\s*(?:\((.*?)\))?\s*$/im'; $content = <<<'EOF' @function setcolor($bg-color: #fff, $contrast: 50%, $desaturate: 100%) { @if lightness($bg-color) < 50 { / light color on dark bg / @return desaturate(lighten($bg-color, $contrast), $desaturate); } @else { / dark color on light bg / @return desaturate(darken($bg-color, $contrast), $desaturate); } } EOF; preg_match($match, $content, $matches); var_dump($matches);
based on FNMYc
Output for 5.3.20 - 7.2.0
array(0) { }