Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Quote string with slashes in a C style
<?php addcslashes(string $string, string $characters): string
<?php                 $links = Preg::replace(

                    '{'.preg_quote($match[1]).'$}',


                    addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),

                    $links

                );

            } else {
<?php                 if ($append) {

                    $children = Preg::replace(

                        '#'.$whitespace.'}$#',

                        addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),

                        $children

                    );

                } else {
<?php                     $children = Preg::replace(

                        '#^{'.$whitespace.'#',

                        addcslashes('{' . $whitespace . JsonFile::encode($name).': '.$this->format($value, 1) . ',' . $this->newline . $this->indent . $this->indent, '\\$'),

                        $children

                    );

                }
<?php         if (Preg::isMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {

            $this->contents = Preg::replace(

                '#'.$match[1].'\}$#',

                addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),

                $this->contents

            );
<?php         $this->contents = Preg::replace(

            '#\}$#',

            addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),

            $this->contents

        );