I am currently trying to change a variable in a configuration file. I've tried the following:

```
public static function change(){
    $fl = file("../config.inc.php");
    $key = $_POST['key'];
    $id = $_POST['id'];
    $secret = $_POST['secret'];
    $content = "";
    foreach($fl as $line){
        $content .= $line;
    }
    $content = preg_replace("\$licence = array\(\'key\'=>\'(.*?)\'\);$", "licence = array('key'=>'$key');", $content);

    $content = preg_replace("/\$rey_connect = array\((.*?\'client_id\'=>\')(.*?)('.*?\'client_secret\'=>\')(.*?)(\')(.*?)(?:\));(?:\n|$)/", "\$rey_connect = array(\1$id\3$secret\5);", $content);

    $myfile = fopen("../config.inc.php", "w") or die("Unable to open file!");
    $txt = "$content";
    fwrite($myfile, $txt);
    fclose($myfile);
}

```

on the following string:

```
<?php
# Bitte bearbeiten Sie diese Datei nicht. #

$mysql = array(  'host'=>'localhost',
                        'database'=>'schnnet',
                        'password'=>'root',
                        'user'=>'root');
$licence = array('key'=>'jZf5hhRd5vqmwTkMB9eq');
$rey_connect = array('active'=>true,'client_id'=>'123','client_secret'=>'123456');
?>

```

So the regex works perfectly [on phpliveregex](http://www.phpliveregex.com/p/brC), but not in my script. Somehow it doesn't affect the configuration file's content.