/*********************************
*
* 자바스크립트에 없는 PHP 함수구현
*
**********************************/
function PHP(){
	
}

/*********************************
*
* 배열 또는 객체 출력
* php.print_r(array);
*
**********************************/
PHP.prototype.print_r = function(arr){
	if(!arr) return false;

	document.write("<ul>");
	var i = 0;
	for(var name in arr){
		var value = arr[name];
		var type = typeof(value);
			
		if(type != "function"){
			document.write("<li>");
			document.write("["+name+"] =>");
			document.write(value+" "+type);
			
			if(type == "object" && value){
				this.print_r(value);
			}
			
			document.write("</li>");


			i++;
		}
	}
	document.write("</ul>");
}

/*********************************
*
* 문자열 양쪽의 공백 제거
* php.trim(string);
* 
**********************************/
PHP.prototype.trim = function(str){
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}

PHP.prototype.toString = function(){
	this.print_r(this);
}



php = new PHP();
