I just want to see what you guys think about this function...it's really simple and at the same time kind of confusing.
I used a really simple switch:
switch($pg){
default:
$content = "welcome";
break;
case "login":
$content = "login here...";
break;
}
But with that I ran into a big problem...you cannot put PHP code inside of $content so I thought of this...
[/code]
function content($type,$con){
if($type == "php"){
$new_con = str_replace('#' , '\'' , $con);
$final_con = str_replace('##' , '\"' , $new_con);
eval($final_con);
} elseif($type == "plaintext"){
echo($con);
} else {
echo "this shouldn't happen....";
}
}
I couldn't use " or ' cause I kept getting errors, so I just use # for single quotes and ## for double quotes.
$joesname = "your mom!";
content("php","echo(##$joesname##);");
And that would output: you mom!
soooooo whatdya thinK?
[edit]lol, i guess I just wanted to do it the hard way eh?[/edit]