UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

16 lines (14 loc) 618 B
function getenv(varname) { // From: http://phpjs.org/functions // + original by: Brett Zamir (http://brett-zamir.me) // % note 1: We are not using $_ENV as in PHP, you could define // % note 1: "$_ENV = this.php_js.ENV;" and get/set accordingly // % note 2: Returns e.g. 'en-US' when set global this.php_js.ENV is set // % note 3: Uses global: php_js to store environment info // * example 1: getenv('LC_ALL'); // * returns 1: false if (!this.php_js || !this.php_js.ENV || !this.php_js.ENV[varname]) { return false; } return this.php_js.ENV[varname]; }