Kembali lagi v8js, inti dari ekstensi adalah menjalankan Javascript dengan PHP. Berikut ini adalah contoh kode dari v8js
<?php $v8 = new V8Js(); /* basic.js */ $JS = <<< EOT len = print('Hello' + ' ' + 'World!' + "\\n"); len; EOT; try { var_dump($v8->executeString($JS, 'basic.js')); } catch (V8JsException $e) { var_dump($e); } ?>Namun sebenarnya banyak yang mempertanyakan dalam kondisi apa ekstensi ini digunakan. Berikut ini adalah beberap komentar mengenai kode diatas:
*shudder*
It says I should write more of that, but I can't. This is really no test of the notes system. - Anonymous
PHP is awesome and all, but please, for the love of God, please stop trying to code JavaScript in it! All this does is encourage bad programmers to write even worse JavaScript. - robertwhurst at gmail dot com
Quality web applications are constructed with JavaScript written properly; in a .js file, If one file is to small the use a module system like RequireJS. - hello at lutoma dot org
What… the… seriously? I mean… like, this is no april fools, right?
I am now gladder than ever I stopped using PHP a long time ago - hello at lutoma dot org
While the usefulness of embedding javascript into PHP may not seem immediately obvious, a highly useful scenario presents itself to me immediately: The ability to run phpunit test on not only your PHP functions, but also the .js files used within your application!
Yes, there are JS unit tests, but the utility of having everything in one place with proper deps checking should not be ignored. -ben at chico dot com
That has to be the single worst idea I've ever seen. Please, make it stop. - evilgenius at nefariousplan dot com
this is really weird. i hope it's an april fool O.O - NetAndr
This feature is a response to node.js project. Coding javascript on the server side. Don't mistake serverside code for clientside code.- SFeraAda pendapat? silakan tulis di komentar...
Artikel Terkait
No comments:
Post a Comment