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/rtWB1
function name:  (null)
number of ops:  32
compiled vars:  !0 = $match, !1 = $content, !2 = $bg, !3 = $contrast, !4 = $desaturate, !5 = $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'
    6     1        ROPE_INIT                                    21  ~8      '%40function+set-color%28'
          2        ROPE_ADD                                      1  ~8      ~8, !2
          3        ROPE_ADD                                      2  ~8      ~8, '-color%3A+%23fff%2C+'
          4        ROPE_ADD                                      3  ~8      ~8, !3
          5        ROPE_ADD                                      4  ~8      ~8, '%3A+50%25%2C+'
          6        ROPE_ADD                                      5  ~8      ~8, !4
          7        ROPE_ADD                                      6  ~8      ~8, '%3A+100%25%29+%7B%0A++++%40if+lightness%28'
    7     8        ROPE_ADD                                      7  ~8      ~8, !2
          9        ROPE_ADD                                      8  ~8      ~8, '-color%29+%3C+50+%7B%0A++++++++%2F+light+color+on+dark+bg+%2F%0A++++++++%40return+desaturate%28lighten%28'
    9    10        ROPE_ADD                                      9  ~8      ~8, !2
         11        ROPE_ADD                                     10  ~8      ~8, '-color%2C+'
         12        ROPE_ADD                                     11  ~8      ~8, !3
         13        ROPE_ADD                                     12  ~8      ~8, '%29%2C+'
         14        ROPE_ADD                                     13  ~8      ~8, !4
         15        ROPE_ADD                                     14  ~8      ~8, '%29%3B%0A++++%7D+%40else+%7B%0A++++++++%2F+dark+color+on+light+bg+%2F%0A++++++++%40return+desaturate%28darken%28'
   12    16        ROPE_ADD                                     15  ~8      ~8, !2
         17        ROPE_ADD                                     16  ~8      ~8, '-color%2C+'
         18        ROPE_ADD                                     17  ~8      ~8, !3
         19        ROPE_ADD                                     18  ~8      ~8, '%29%2C+'
         20        ROPE_ADD                                     19  ~8      ~8, !4
         21        ROPE_END                                     20  ~7      ~8, '%29%3B%0A++++%7D%0A%7D'
    5    22        ASSIGN                                                   !1, ~7
   17    23        INIT_FCALL                                               'preg_match'
         24        SEND_VAR                                                 !0
         25        SEND_VAR                                                 !1
         26        SEND_REF                                                 !5
         27        DO_ICALL                                                 
   19    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !5
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.82 ms | 1396 KiB | 17 Q