You would expect this function to print the name in a browser, and it does:
<?php
function name(){
$var = 'Doe';
?>
John <?php echo $var;
}
name();
?>
Could this type of function be used as a method of a PHP class, and is this bad code practice?
There is no [syntax] problem but I hardly can imagine a case when I can use such a code.