<?php
$x = array(
    'group' => array(
        'key' => 'value',
        'key_second' => 'value2'
    ),
	'secondgroup'=> array(
		'thirdgroup'=> array(
			'key'=>'value3',
			'bool'=>true,
			'NULL'=>NULL
		)
	)
);
	
function reconvert($array,$del,$path=array()){
	$string="";
	foreach($array as $key=>$val){
		if(is_string($val) || is_numeric($val)){
			$string.=implode($del,$path).$del.$key.$del.$val."\n";
		} else if(is_bool($val)){
			$string.=implode($del,$path).$del.$key.$del.($val?"True":"False")."\n";
		} else if(is_null($val)){
			$string.=implode($del,$path).$del.$key.$del."NULL\n";
		}else if(is_array($val)=='array') {
			$path[]=$key;
			$string.=reconvert($val,$del,$path);
			array_pop($path);
		} else {
        	throw new Exception($key." has type ".gettype($val).' which is not a printable value.');
		}
	}
	return $string;
}
echo reconvert($x,"|");
