3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNMYc
function name:  (null)
number of ops:  11
compiled vars:  !0 = $match, !1 = $content, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%5E%40function%5Cs%2B%28%5B_%5C-%5Cw%5D%2B%29%5Cs%2A%28%3F%3A%5C%28%28.%2A%3F%29%5C%29%29%3F%5Cs%2A%24%2Fim'
    5     1        ASSIGN                                                   !1, '%40function+set-color%28%24bg-color%3A+%23fff%2C+%24contrast%3A+50%25%2C+%24desaturate%3A+100%25%29+%7B%0A++++%40if+lightness%28%24bg-color%29+%3C+50+%7B%0A++++++++%2F+light+color+on+dark+bg+%2F%0A++++++++%40return+desaturate%28lighten%28%24bg-color%2C+%24contrast%29%2C+%24desaturate%29%3B%0A++++%7D+%40else+%7B%0A++++++++%2F+dark+color+on+light+bg+%2F%0A++++++++%40return+desaturate%28darken%28%24bg-color%2C+%24contrast%29%2C+%24desaturate%29%3B%0A++++%7D%0A%7D'
   17     2        INIT_FCALL                                               'preg_match'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        DO_ICALL                                                 
   19     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.05 ms | 1394 KiB | 17 Q