public function replaceOneValue($search, $replacement = ''): self
    {
        $array = $this->getArray();
        $key = \array_search($search, $array, true);

        if ($key !== false) {
            $array[$key] = $replacement;
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
public function replaceOneValue($search, $replacement = ''): self
    {
        $array = $this->getArray();
        $key = \array_search($search, $array, true);

        if ($key !== false) {
            $array[$key] = $replacement;
        }

        return static::create(
            $array,
            $this->iteratorClass,
            false
        );
    }
public function replaceOneValue ( $ search , $ replacement = '' ) : self { $ array = $ this -> getArray ( ) ; $ key = \ array_search ( $ search , $ array , true ) ; if ( $ key !== false ) { $ array [ $ key ] = $ replacement ; } return static :: create ( $ array , $ this -> iteratorClass , false ) ; }
Replace the first matched value in an array.

@param mixed $search      <p>The value to replace.</p>
@param mixed $replacement <p>The value to replace.</p>

@return static
<p>(Immutable)</p>
Replace the first matched value in an array .