Answer the question
In order to leave comments, you need to log in
What are the PHP Refactoring Tools or your ideas for modifying existing ones or creating them?
Approximately it should work like this:
<?php
function ping($host, $action=false){
[email protected]($host, 80, $errno, $errstr, 1);
if($http){
fwrite($http, "GET /".$action." HTTP/1.0\r\nAccept: */*\r\nHost: ".$host."\r\n\r\n");
fclose($http);
return true;
}else{
return false;
}
}
?>
converted to<?php function ping($host, $action=false) { return ([email protected]($host, 80, $errno, $errstr, 1)) ? fwrite($http, "GET /".$action." HTTP/1.0\r\nAccept: */*\r\nHost: ".$host."\r\n\r\n").fclose($http) : false; }
Answer the question
In order to leave comments, you need to log in
What is given in the question is neither refactoring nor obfuscation. But rather govnokoding. A couple of drunken Indians for a dozen bucks will help you make such an optimization.
Now more seriously. What you are doing is bad to say the least. The fact that the code has become 2 spaces less and the condition has changed to another will not make your code easier, faster, cooler. What has been done is killing the readability and maintainability of the code. If there is a desire to optimize the code, then use the " accelerators " and leave your code alone, so that later you can easily fix it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question