I used eclipse to format it. It's different than I like, but it doesn't seem to be capable of linefeeding the braces in the PHP editor. Not sure why; pretty sure it does that with the java editor.
I think I'm confused by exactly what the branches are doing here. No matter, remove the if branch for the magic quotes completely, and above the isset($_POST['number']) check simply do it there:
$_POST = array_map('stripslashes', $_POST);