3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $match = '/^@function\s+([_\-\w]+)\s*(?:\((.*?)\))?\s*$/im'; $content = <<<EOF @function set-color($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);
Output for 7.0.0 - 7.2.0
Notice: Undefined variable: bg in /in/rtWB1 on line 6 Notice: Undefined variable: contrast in /in/rtWB1 on line 6 Notice: Undefined variable: desaturate in /in/rtWB1 on line 6 Notice: Undefined variable: bg in /in/rtWB1 on line 7 Notice: Undefined variable: bg in /in/rtWB1 on line 9 Notice: Undefined variable: contrast in /in/rtWB1 on line 9 Notice: Undefined variable: desaturate in /in/rtWB1 on line 9 Notice: Undefined variable: bg in /in/rtWB1 on line 12 Notice: Undefined variable: contrast in /in/rtWB1 on line 12 Notice: Undefined variable: desaturate in /in/rtWB1 on line 12 array(0) { }
Output for 5.3.20 - 5.6.28
Notice: Undefined variable: bg in /in/rtWB1 on line 6 Notice: Undefined variable: contrast in /in/rtWB1 on line 6 Notice: Undefined variable: desaturate in /in/rtWB1 on line 7 Notice: Undefined variable: bg in /in/rtWB1 on line 9 Notice: Undefined variable: bg in /in/rtWB1 on line 9 Notice: Undefined variable: contrast in /in/rtWB1 on line 9 Notice: Undefined variable: desaturate in /in/rtWB1 on line 12 Notice: Undefined variable: bg in /in/rtWB1 on line 12 Notice: Undefined variable: contrast in /in/rtWB1 on line 12 Notice: Undefined variable: desaturate in /in/rtWB1 on line 14 array(0) { }