preg_replace_callback

Supported Versions: PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8
Perform a regular expression search and replace using a callback
<?php preg_replace_callback(    string|array $pattern,    callable $callback,    string|array $subject,    int $limit = -1,    int &$count = null,    int $flags = 0): string|array|null
<?php             }



            if (str_contains($identifier, "@anonymous\0")) {

                $this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {

                    return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];

                }, $identifier);

            }



            if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) {
<?php         unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);



        if (isset($a[Caster::PREFIX_PROTECTED.'message']) && str_contains($a[Caster::PREFIX_PROTECTED.'message'], "@anonymous\0")) {

            $a[Caster::PREFIX_PROTECTED.'message'] = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {

                return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];

            }, $a[Caster::PREFIX_PROTECTED.'message']);

        }



        if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
<?php         $map = static::$controlCharsMap;

        $startCchr = $this->colors ? "\033[m\033[{$this->styles['default']}m" : '';

        $endCchr = $this->colors ? "\033[m\033[{$this->styles[$style]}m" : '';

        $value = preg_replace_callback(static::$controlCharsRx, function ($c) use ($map, $startCchr, $endCchr) {

            $s = $startCchr;

            $c = $c[$i = 0];

            do {

                $s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));

            } while (isset($c[++$i]));



            return $s.$endCchr;

        }, $value, -1, $cchrCount);



        if ($this->colors) {

            if ($cchrCount && "\033" === $value[0]) {
<?php             }

        }



        $v = "<span class=sf-dump-{$style}>".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) {

            $s = $b = '<span class="sf-dump-default';

            $c = $c[$i = 0];

            if ($ns = "\r" === $c[$i] || "\n" === $c[$i]) {

                $s .= ' sf-dump-ns';

            }

            $s .= '">';

            do {

                if (("\r" === $c[$i] || "\n" === $c[$i]) !== $ns) {

                    $s .= '</span>'.$b;

                    if ($ns = !$ns) {

                        $s .= ' sf-dump-ns';

                    }

                    $s .= '">';

                }



                $s .= $map[$c[$i]] ?? sprintf('\x%02X', \ord($c[$i]));

            } while (isset($c[++$i]));



            return $s.'</span>';

        }, $v).'</span>';



        if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], $attr['line'] ?? 0)) {

            $attr['href'] = $href;