protected function buildArrayExpression($targetKey, $arrayItems = [])
    {
        $expression = [];

        // Opening expression for array items ($1)
        $expression[] = $this->buildArrayOpeningExpression($arrayItems);

        // The target key opening ($2)
        $expression[] = '([\'|"]'.$targetKey.'[\'|"]\s*=>\s*)';

        // The target value to be replaced ($3)
        $expression[] = '(?:[aA][rR]{2}[aA][yY]\(|[\[])([^\]|)]*)[\]|)]';

        return '/'.implode('', $expression).'/';
    }
protected function buildArrayExpression($targetKey, $arrayItems = [])
    {
        $expression = [];

        // Opening expression for array items ($1)
        $expression[] = $this->buildArrayOpeningExpression($arrayItems);

        // The target key opening ($2)
        $expression[] = '([\'|"]'.$targetKey.'[\'|"]\s*=>\s*)';

        // The target value to be replaced ($3)
        $expression[] = '(?:[aA][rR]{2}[aA][yY]\(|[\[])([^\]|)]*)[\]|)]';

        return '/'.implode('', $expression).'/';
    }
protected function buildArrayExpression ( $ targetKey , $ arrayItems = [ ] ) { $ expression = [ ] ; // Opening expression for array items ($1) $ expression [ ] = $ this -> buildArrayOpeningExpression ( $ arrayItems ) ; // The target key opening ($2) $ expression [ ] = '([\'|"]' . $ targetKey . '[\'|"]\s*=>\s*)' ; // The target value to be replaced ($3) $ expression [ ] = '(?:[aA][rR]{2}[aA][yY]\(|[\[])([^\]|)]*)[\]|)]' ; return '/' . implode ( '' , $ expression ) . '/' ; }
Single level arrays only
@param $targetKey
@param array $arrayItems
@return string
Single level arrays only