Location: PHPKode > scripts > convert > convert/convert.php
<?php

class convert
{

	/**
	 * 	$orig - string to edit
	 * $open_str -string to use as the key (ie $_POST[ )
	 * $open_char - string to use as nest building (ie [ )
	 * $close_char - string to close to set (ie ] )
	 * $open_replace - what the string is to be replaced with
	 * $close_replace -what the string is to be replaced with in the end
	 * */
	function funcConvert($orig,$open_str,$open_char,$close_char, $open_replace, $close_replace)
	{
		$open_str_len = strlen($open_str);
	
		// walk through orig string
		for($walkOrig = 0; $walkOrig < strlen($orig); $walkOrig++){

			// if "KEY[" found, look for closing "]"
			if(substr($orig, $walkOrig, $open_str_len) == $open_str){
				// we're in one bracket
				$nest = 1;
				
				// walk through rest of orig string after "KEY["
				for($findClose = $walkOrig + $open_str_len; $findClose < strlen($orig); $findClose++){
					// if another "[" found, add to "nesting" count
					if(substr($orig, $findClose, 1) == "$open_char"){
						$nest++;
					// else if "]" found, subtract from "nesting" count
					} elseif(substr($orig, $findClose, 1) == "$close_char"){
						$nest--;
						
						// if current "]" closed off original "KEY[", convert "KEY[...]" to "get(...)", call funcConvert on inside of "KEY[...]" for nesting, call funcConvert on orig string after "KEY[...]" for stiff we haven't hit, and return
						if($nest == 0){
							return substr($orig, 0, $walkOrig) . $open_replace . funcConvert(substr($orig, $walkOrig + $open_str_len, $findClose - $walkOrig - $open_str_len),$open_str,$open_char,$close_char, $open_replace, $close_replace) 
									. $close_replace . funcConvert(substr($orig, $findClose + 1),$open_str,$open_char,$close_char,$open_replace, $close_replace);
						}
					}
				}
				
				// closing "]" for "KEY[" wasn't found - some error in nesting, return ERROR message
				return substr($orig, 0, $walkOrig) . ">UNIQUE_ERROR_MESSAGE<";
			}
		}
		
		// "KEY[" wasn't found - return orig string
		return $orig;
	}


}

?>

Replaces $_POST['value'] with get('value')<br>
echo ($source, "\$_POST[","[","]","(",")");
Return current item: convert