Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ini_get(3) [php man page]

INI_GET(3)								 1								INI_GET(3)

ini_get - Gets the value of a configuration option

SYNOPSIS
string ini_get (string $varname) DESCRIPTION
Returns the value of the configuration option on success. PARAMETERS
o $varname - The configuration option name. RETURN VALUES
Returns the value of the configuration option as a string on success, or an empty string for null values. Returns FALSE if the configura- tion option doesn't exist. EXAMPLES
Example #1 A few ini_get(3) examples <?php /* Our php.ini contains the following settings: display_errors = On register_globals = Off post_max_size = 8M */ echo 'display_errors = ' . ini_get('display_errors') . " "; echo 'register_globals = ' . ini_get('register_globals') . " "; echo 'post_max_size = ' . ini_get('post_max_size') . " "; echo 'post_max_size+1 = ' . (ini_get('post_max_size')+1) . " "; echo 'post_max_size in bytes = ' . return_bytes(ini_get('post_max_size')); function return_bytes($val) { $val = trim($val); $last = strtolower($val[strlen($val)-1]); switch($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $val *= 1024; case 'm': $val *= 1024; case 'k': $val *= 1024; } return $val; } ?> The above example will output something similar to: display_errors = 1 register_globals = 0 post_max_size = 8M post_max_size+1 = 9 post_max_size in bytes = 8388608 NOTES
Note When querying boolean values A boolean ini value of off will be returned as an empty string or "0" while a boolean ini value of on will be returned as "1". The function can also return the literal string of INI value. Note When querying memory size values Many ini memory size values, such as upload_max_filesize, are stored in the php.ini file in shorthand notation. ini_get(3) will return the exact string stored in the php.ini file and NOT its integer equivalent. Attempting normal arithmetic functions on these values will not have otherwise expected results. The example above shows one way to convert shorthand notation into bytes, much like how the PHP source does it. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.3.0 | | | | | | | Previously, the empty string was returned if the | | | configuration option didn't exist. now, FALSE is | | | returned instead. | | | | +--------+---------------------------------------------------+ SEE ALSO
get_cfg_var(3), ini_get_all(3), ini_restore(3), ini_set(3). PHP Documentation Group INI_GET(3)

Check Out this Related Man Page

DATE_DEFAULT_TIMEZONE_GET(3)						 1					      DATE_DEFAULT_TIMEZONE_GET(3)

date_default_timezone_get - Gets the default timezone used by all date/time functions in a script

SYNOPSIS
string date_default_timezone_get (void ) DESCRIPTION
In order of preference, this function returns the default timezone by: o Reading the timezone set using the date_default_timezone_set(3) function (if any) o Prior to PHP 5.4.0 only: Reading the $TZ environment variable (if non empty) o Reading the value of the date.timezone ini option (if set) o Prior to PHP 5.4.0 only: Querying the host operating system (if supported and allowed by the OS). This uses an algorithm that has to guess the time- zone. This is by no means going to work correctly for every situation. A warning is shown when this stage is reached. Do not rely on it to be guessed correctly, and set date.timezone to the correct timezone instead. If none of the above succeed, date_default_timezone_get will return a default timezone of UTC. RETURN VALUES
Returns a string. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 5.4.0 | | | | | | | The TZ environment variable is no longer used to | | | guess the timezone. | | | | | 5.4.0 | | | | | | | The timezone is no longer guessed from informa- | | | tion available through the operating system as | | | the guessed timezone can not be relied on. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 Getting the default timezone <?php date_default_timezone_set('Europe/London'); if (date_default_timezone_get()) { echo 'date_default_timezone_set: ' . date_default_timezone_get() . '<br />'; } if (ini_get('date.timezone')) { echo 'date.timezone: ' . ini_get('date.timezone'); } ?> The above example will output something similar to: date_default_timezone_set: Europe/London date.timezone: Europe/London Example #2 Getting the abbreviation of a timezone <?php date_default_timezone_set('America/Los_Angeles'); echo date_default_timezone_get() . ' => ' . date('e') . ' => ' . date('T'); ?> The above example will output: America/Los_Angeles => America/Los_Angeles => PST SEE ALSO
date_default_timezone_set(3), "List of Supported Timezones". PHP Documentation Group DATE_DEFAULT_TIMEZONE_GET(3)
Man Page