public function findReplaceValue()
    {
        if (is_array($this->findText)) {
            //can be array
            $searchReplaceArray = [];
            foreach ($this->findText as $key => $value) {
                $searchReplaceArray[$value] = $this->replaceText;
            }
        } else {
            $searchReplaceArray = [
                $this->findText => $this->replaceText,
            ];
        }

        $this->owner->{$this->attribute} = str_replace(
            array_keys($searchReplaceArray),
            array_values($searchReplaceArray),
            $this->owner->{$this->attribute}
        );
    }
public function findReplaceValue()
    {
        if (is_array($this->findText)) {
            //can be array
            $searchReplaceArray = [];
            foreach ($this->findText as $key => $value) {
                $searchReplaceArray[$value] = $this->replaceText;
            }
        } else {
            $searchReplaceArray = [
                $this->findText => $this->replaceText,
            ];
        }

        $this->owner->{$this->attribute} = str_replace(
            array_keys($searchReplaceArray),
            array_values($searchReplaceArray),
            $this->owner->{$this->attribute}
        );
    }
public function findReplaceValue ( ) { if ( is_array ( $ this -> findText ) ) { //can be array $ searchReplaceArray = [ ] ; foreach ( $ this -> findText as $ key => $ value ) { $ searchReplaceArray [ $ value ] = $ this -> replaceText ; } } else { $ searchReplaceArray = [ $ this -> findText => $ this -> replaceText , ] ; } $ this -> owner -> { $ this -> attribute } = str_replace ( array_keys ( $ searchReplaceArray ) , array_values ( $ searchReplaceArray ) , $ this -> owner -> { $ this -> attribute } ) ; }
Find and replace text
Accepts find as string or array
Find and replace text Accepts find as string or array