oh, my bad. lol, i read didn't sorry it will work, gosh what am I thinking its all this last minute work for my website...
Printable View
oh, my bad. lol, i read didn't sorry it will work, gosh what am I thinking its all this last minute work for my website...
I would do it this way if i had to write that:
PHP Code:<?php
function fixcode($Codefixer){
$Codefixer = ereg_replace('<br>', '<br />', $Codefixer);
return $Codefixer;
}
?>
<form action="fix.php" method="post">
<textarea cols="50" rows="10" name="Codefixer"><?php echo htmlspecialchars(fixcode($_POST["CODEFIXER"])); ?></textarea>
<input type="submit">
</form>
But that's essentially one statement. It's really rather pointless having one-statement functions, except for the occasional semantic benefit or where it's likely that the implementation will be changed at a later date, neither of which apply here. Also, using regex-parsing functions for static strings is a great way to waste resources, and we've already determined that it's better to use HTML than XHTML here, so the transformation needs to go the other way.Quote:
Code:function fixcode($Codefixer){
$Codefixer = ereg_replace('<br>', '<br />', $Codefixer);
return $Codefixer;
}