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         $writer = new InvoicesDocWriter();

        $invoicesDocXmlString = $writer->asXML(new InvoicesDoc($this->invoices));



        $invoicesDocXmlString = str_replace('InvoicesDoc', 'RequestedDoc', $invoicesDocXmlString);




        $reader = new RequestedDocReader();
<?php     public function setAttributes(array $attributes): static

    {

        foreach ($attributes as $key => $value) {

            $set = 'set'.str_replace('_', '', ucwords($key, '_'));



            if (is_object($value) || !method_exists($this, $set)) {

                $this->attributes[$key] = $value;