PHP-функция: require_onceСписок php-функций

javascript:

function require_once(filename) {
	// The require_once() statement includes and evaluates the specified file during
	// the execution of the script. This is a behavior similar to the require()
	// statement, with the only difference being that if the code from a file has
	// already been included, it will not be included again.  See the documentation for
	// require() for more information on how this statement works.
	// 
	// +   original by: Michael White (http://crestidg.com)

	var cur_file = {};
	cur_file[window.location.href] = 1;

	if (!window.php_js) window.php_js = {};
	if (!window.php_js.includes) window.php_js.includes = cur_file;
	if (!window.php_js.includes[filename]) {
		if (!window.php_js.required) window.php_js.required = {};
		if (!window.php_js.required[filename]) {
			return this.require(filename);
		} else {
			return window.php_js.required[filename];
		}
	} else{
		return window.php_js.includes[filename];
	}
}

//Примеры:

alert ( require_once('../ex.js') );