Question: I need to open new WPA/WPA2 device from linux c code.
Now I create it manualy by using wpa\_supplicant

```
wpa_supplicant -iwlan0 -c connfig.conf -B

```

* How I can to start it from my code (without using system() )?
* What wpa\_supplicant interface is intended for this ?

Maybe, do you have any example ?
hanks in advance

Answer: 
I have another solution based on eval
I just concatenate the strings with brackets around

```
<?php
Class foo {
    private $config=array();

    function __construct(){    
        $this->config['site']['title'] = 'testing';
        $this->config['site']['favicon'] = 'XXXXX.ico';
        $this->config['site']['keywords'] = array('page','cute','other');        
        $this->config['otherthing'] = 'value';
        /**etc**/
    }

    public function set($name,$value)
    {
        $tmp = explode('.',$name);
        $array_levels = "['";
        foreach($tmp as $key) {
            $array_levels .= $key."']['";
        }
        $array_levels = substr($array_levels, 0, -2);
        eval('$this->config'.$array_levels.' = $value;');
    }
    public function get($name)
    {
        $tmp = explode('.',$name);
        $array_levels = "['";
        foreach($tmp as $key) {
            $array_levels .= $key."']['";
        }
        $array_levels = substr($array_levels, 0, -2);
        eval('$value = $this->config'.$array_levels.';');
        return $value;
    }
}
$thing = new foo;
$thing->set('site.keywords',array('other','keywords'));
echo $thing->get('site.title');

```
As you can see [here](http://php.net/manual/en/function.explode.php), the function `explode` takes the string and returns an array. So here is what you need to do:

```
public function set($name,$value)
    {
        $tmp = explode('.',$name); //$tmp will now contain an array, so if $name = 'site.keywords'
                                   //$tmp[0] will contain 'site' and $tmp[1] = 'keywords'
        //if you send 'otherthing' as $name, then $tmp[1] will have no value
        if(isset($tmp[1])){
                $this->config[$tmp[0]][$tmp[1]] = $value; // this is like saying  $this-config['site']['keywords'] = $value
        }
        else{
            $this->config[$tmp[0]] = $value; 
        }
    }

```

And for the get:

```
public function get($name)
    {
        $tmp = explode('.',$name);
        if(isset($tmp[1])){
            return $this->config[$tmp[0]][$tmp[1]];
        }
        else{
           return $this->config[$tmp[0]];
        }

    }

```