All pastes #105818 Raw Edit

ini.php

public php v1 · immutable
#105818 ·published 2006-07-29 22:27 UTC
rendered paste body
<?phperror_reporting(E_ALL);function ini($ini,$section = null,$item = null) {    $file = file($ini);    while (list($key,$val) = each($file)) {        if ($val{0} == '[') {            $k = trim($val,"[]\n");        } else {            $data = explode("=",$val,2);            $keys[$k][$data[0]] = trim($data[1],"\n");        }    }    if ($item == null) {        return $keys[$section];    } elseif ($section == null) {        return $keys;    } else {        return $keys[$section][$item];    }}?>