P
P
PO6OT2016-10-06 18:39:29
PHP
PO6OT, 2016-10-06 18:39:29

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; }

So that at least a little bit understand the shit code and use the features of system functions to replace custom ones.
Maybe you have your own ideas of optimal refactoring? Tell me - I will be glad to bring them to life in the form of an online tool, if I do not find a ready one.
The refactorer is desirable to work on Windows or online.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2016-10-06
@pudovMaxim

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.

E
entermix, 2016-10-06
@entermix

What do you mean by "Refactoring"?
https://ru.wikipedia.org/wiki/%D0%A0%D0%B5%D1%84%D...
How did your output code become clearer? By the fact that you added a ternary operator? But why did you put everything on one line?
Your output is more of an obfuscation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question