What's wrong with this program? It never returns done and the mail never goes out. if you remove getOrDefault function it works fine. It doesn't throw an error or an exception on php 5.3.13
<?php
function getOrDefault(&$var, $default = null) {
// because I'm tired of typing $x = isset($_POST['x'])? $_POST['x']:null;
if (isset($var)) {
return $var;
} else {
return $default;
}
}
$HTTP_CLIENT_IP = getOrDefault($_SERVER['HTTP_CLIENT_IP']);
mail('test@gmail.com', 'test', $HTTP_CLIENT_IP);
echo 'done';
?>