Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Replace all occurrences of the search string with the replacement string
<?php str_replace(    array|string $search,    array|string $replace,    string|array $subject,    int &$count = null): string|array
<?php         $text = preg_replace_callback(

            $this->regexp(),

            fn (array $matches): string => str_replace(

                ['%{alt}', '%{src}'],

                [

                    $alt

                        ? $alt($matches[0])

                        : $matches[0],

                    Twemoji::emoji($matches[0])

                        ->base($this->base)

                        ->type($this->type)

                        ->url(),

                ],

                $replacement

            ),

            $text

        );