DEV Community

Discussion on: PHP For JavaScript Developers

agitri profile image

Im talking about jdk and not js 😊

Thread Thread
lokidev profile image

And it's still wrong. There are business cases for java and others for PHP. Both are valid languages, but none is superior to the other.

Btw: Would you show me your goto java solution which doesn't need dependencies, takes an json-url, gets the content and pretty prints its content in a file?

$content = file_get_contents(URL);
$jsonObject = json_decode($content);
$beautifulJsonString = json_encode($jsonObject, JSON_PRETTY_PRINT);
file_put_contents(FILENAME, $beautifulJsonString);

15s - I really want to see doing that in Java :D.