<?php
function path($page, $id, $raw = false){
	
	if(!$raw){
		$id = urlencode($id); // I do need to get rid of that, that is why I wanted to use the raw-filter, simulated by the third argument.
	}
	
	switch($page){
		case 'article_edit':
			return "'article/" . $id . "/edit'";
		break;
		case 'comment_add':
			return "'comment/" . $id . "/add'";
		break;
	}
	
}
?>
<script>
	// this is not working, as $id gets encoded.
	for(var i=1; i<=3; i++){

		document.write(<?= path('article_edit', "' + i + '") ?> + '<br>\n');

	}
	
	// this is working, due to the use of the raw-filter simulation
	for(var i=1; i<=3; i++){

		document.write(<?= path('article_edit', "' + i + '", true) ?> + '<br>\n');

	}
</script>