Install via yarn add locutus and import:
import { ini_get } from 'locutus/php/info/ini_get'.
Or with CommonJS: const { ini_get } = require('locutus/php/info/ini_get')
Use a bundler that supports tree-shaking so you only ship the functions you actually use.
Vite,
webpack,
Rollup, and
Parcel
all handle this. For server-side use this is less of a concern.
Examples
These examples are extracted from test cases that automatically verify our functions against their native counterparts.
exportfunctionini_get(varname: string): string { // discuss at: https://locutus.io/php/ini_get/ // original by: Brett Zamir (https://brett-zamir.me) // note 1: The ini values must be set by ini_set or manually within an ini file // example 1: ini_set('date.timezone', 'Asia/Hong_Kong') // example 1: ini_get('date.timezone') // returns 1: 'Asia/Hong_Kong'
exportfunctionini_get(varname) { // discuss at: https://locutus.io/php/ini_get/ // original by: Brett Zamir (https://brett-zamir.me) // note 1: The ini values must be set by ini_set or manually within an ini file // example 1: ini_set('date.timezone', 'Asia/Hong_Kong') // example 1: ini_get('date.timezone') // returns 1: 'Asia/Hong_Kong'
return { ini, locales, localeCategories, pointers, locale_default: localeDefault, } }
// php/info/ini_get (target function module) functionini_get(varname: string): string { // discuss at: https://locutus.io/php/ini_get/ // original by: Brett Zamir (https://brett-zamir.me) // note 1: The ini values must be set by ini_set or manually within an ini file // example 1: ini_set('date.timezone', 'Asia/Hong_Kong') // example 1: ini_get('date.timezone') // returns 1: 'Asia/Hong_Kong'
return { ini, locales, localeCategories, pointers, locale_default: localeDefault, } }
// php/info/ini_get (target function module) functionini_get(varname) { // discuss at: https://locutus.io/php/ini_get/ // original by: Brett Zamir (https://brett-zamir.me) // note 1: The ini values must be set by ini_set or manually within an ini file // example 1: ini_set('date.timezone', 'Asia/Hong_Kong') // example 1: ini_get('date.timezone') // returns 1: 'Asia/Hong_Kong'
if (entry && entry.local_value !== undefined) { if (entry.local_value === null) { return'' } returnString(entry.local_value) }
return'' }
Improve this function
Locutus is a community effort following
The McDonald's Theory:
we ship first iterations, hoping others will improve them.
If you see something that could be better, we'd love your contribution.