lib/IniModifier.php
public function getValue($name, $section = 0, $key = null)
    {
        if (!isset($this->content[$section])) {
            return;
        }
        $arrayValue = array();
        $isArray = false;
        foreach ($this->content[$section] as $k => $item) {
            if (($item[0] != self::TK_VALUE && $item[0] != self::TK_ARR_VALUE)
                || $item[1] != $name) {
                continue;
            }
            if ($item[0] == self::TK_ARR_VALUE) {
                if ($key !== null) {
                    if ($item[3] != $key) {
                        continue;
                    }
                } else {
                    $isArray = true;
                    $arrayValue[] = $item[2];
                    continue;
                }
            }

            if (preg_match('/^-?[0-9]$/', $item[2])) {
                return intval($item[2]);
            } elseif (preg_match('/^-?[0-9\.]$/', $item[2])) {
                return floatval($item[2]);
            } elseif (strtolower($item[2]) === 'true' || strtolower($item[2]) === 'on') {
                return true;
            } elseif (strtolower($item[2]) === 'false' || strtolower($item[2]) === 'off') {
                return false;
            }

            return $item[2];
        }
        if ($isArray) {
            return $arrayValue;
        }

        return;
    }
public function getValue($name, $section = 0, $key = null)
    {
        if (!isset($this->content[$section])) {
            return;
        }
        $arrayValue = array();
        $isArray = false;
        foreach ($this->content[$section] as $k => $item) {
            if (($item[0] != self::TK_VALUE && $item[0] != self::TK_ARR_VALUE)
                || $item[1] != $name) {
                continue;
            }
            if ($item[0] == self::TK_ARR_VALUE) {
                if ($key !== null) {
                    if ($item[3] != $key) {
                        continue;
                    }
                } else {
                    $isArray = true;
                    $arrayValue[] = $item[2];
                    continue;
                }
            }

            if (preg_match('/^-?[0-9]$/', $item[2])) {
                return intval($item[2]);
            } elseif (preg_match('/^-?[0-9\.]$/', $item[2])) {
                return floatval($item[2]);
            } elseif (strtolower($item[2]) === 'true' || strtolower($item[2]) === 'on') {
                return true;
            } elseif (strtolower($item[2]) === 'false' || strtolower($item[2]) === 'off') {
                return false;
            }

            return $item[2];
        }
        if ($isArray) {
            return $arrayValue;
        }

        return;
    }
public function getValue ( $ name , $ section = 0 , $ key = null ) { if ( ! isset ( $ this -> content [ $ section ] ) ) { return ; } $ arrayValue = array ( ) ; $ isArray = false ; foreach ( $ this -> content [ $ section ] as $ k => $ item ) { if ( ( $ item [ 0 ] != self :: TK_VALUE && $ item [ 0 ] != self :: TK_ARR_VALUE ) || $ item [ 1 ] != $ name ) { continue ; } if ( $ item [ 0 ] == self :: TK_ARR_VALUE ) { if ( $ key !== null ) { if ( $ item [ 3 ] != $ key ) { continue ; } } else { $ isArray = true ; $ arrayValue [ ] = $ item [ 2 ] ; continue ; } } if ( preg_match ( '/^-?[0-9]$/' , $ item [ 2 ] ) ) { return intval ( $ item [ 2 ] ) ; } elseif ( preg_match ( '/^-?[0-9\.]$/' , $ item [ 2 ] ) ) { return floatval ( $ item [ 2 ] ) ; } elseif ( strtolower ( $ item [ 2 ] ) === 'true' || strtolower ( $ item [ 2 ] ) === 'on' ) { return true ; } elseif ( strtolower ( $ item [ 2 ] ) === 'false' || strtolower ( $ item [ 2 ] ) === 'off' ) { return false ; } return $ item [ 2 ] ; } if ( $ isArray ) { return $ arrayValue ; } return ; }
return the value of an option in the ini file. If the option doesn't exist,
it returns null.

@param string $name    the name of the option to retrieve
@param string $section the section where the option is. 0 is the global section
@param int    $key     for option which is an item of array, the key in the array

@return mixed the value
return the value of an option in the ini file . If the option doesn t exist it returns null .