 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
DZone.com: Running JavaScript inside PHP code
by Chris Cornutt March 01, 2012 @ 09:56:45
On DZone.com Giorgio Sironi has a new post about an interesting new PHP extension that lets you run javascript inside PHP - v8js (VERY alpha right now).
v8js is a new PHP extension able to run JavaScript code inside V8, Google's JavaScript interpreter that powers for example Chrome and NodeJS. This extension is highly alpha - and its API would probably change in the months ahead. Since documentation is lacking, I invite you to repeat the discovering process I follow in this post in case you find some differences in a new version of v8js.
He gives you the (PECL-based) commands to get the extension and it's needed dependencies installed and enabled. He uses PHP's own Reflection features to look at the extension and find its methods including: "executeString", "getPendingException" and "getExtensions".
To show it in action, he implements an old standby to test new languages - the FizzBuzz example - in Javascript, executed inside the PHP. He also includes a quick example of how to load in an external Javascript file and execute the results.
voice your opinion now!
javascript extension execute v8js google interpreter
Github.com: Lisphp - Lisp in PHP
by Chris Cornutt July 07, 2010 @ 10:55:55
From the "just because you can" category today Lunant has created a port of the Lisp language via an interpreter in PHP - Lisphp.
Lisphp is a Lisp dialect written in PHP. It was created to be embedded in web services or to be distributed within web applications. For that reason, it implements sandbox environment for security issues and multiple environment instances.
You can grab the latest code from the github page for the project as well as check out some of the tutorials and details about using the interpreter features like use/from, custom functions and custom macros.
voice your opinion now!
lisp interpreter dialect github
Jack Diederich's Blog: Comparing the Ruby/PHP/Python C Interpreters
by Chris Cornutt March 17, 2010 @ 15:02:13
Recently on his blog Jack Diederich took a look at three different interpreters for Ruby, PHP and Python to see how they were implemented as compared to the language they're used in.
The other day I went poking around the Ruby and PHP interpreters (the current stable versions). I hadn't looked inside PHP since the 4.x series and Ruby I had never checked out. Like CPython the internals of both PHP and Ruby look something like their resulting language, but in C. For each interpreter I just compiled it and looked at how core types and extension types were implemented.
For PHP, he went with the PHP 5.2.13 release and talks about the compile process (a bit spammy), running the unit tests that come included and how the interpreter handles data types, core types and objects.
voice your opinion now!
compare interpreter ruby python
Johan Mares' Blog: Running PHP CLI shell scripts
by Chris Cornutt January 06, 2009 @ 08:47:57
Johan Mares has a recent post about using PHP on the command line:
I already knew how to run PHP scripts from the command line (CLI), although I never really used it. What was new to me was that there are 2 ways of doing this. The first one is by using the php command and the second, and new for me, is by adding a shebang on the first line of your script.
His first way is to run the PHP file through the interpreter directly (via a command line call to something like "php myfile.php"). The second it to actually include the path to the interpreter inside the PHP file itself and use the shell to execute the contents based on that (adding something like "#!/path/to/php" at the top). Then you just make the file executable and you can run it like any other binary file.
voice your opinion now!
cli commandline script method interpreter shebang
PHPImpact Blog: PHP implemented in 100% Java
by Chris Cornutt August 11, 2008 @ 07:58:31
In this recent post to the PHP::Impact blog, Federico talks about a slightly scary thing - a version of PHP implemented 100% in Java.
Quercus allows developers to incorporate Java code into PHP web applications and gives both Java and PHP developers a fast, safe, and powerful alternative to the standard PHP interpreter.
He mentions what it supports - things like Unicode and several of the popular extensions like APC, GD, MySQL, Oracle and PDF). There's also benefits he points out like the speed of the libraries (and safety) as well as interoperability with Java code and frameworks. Check out the official Quercus website for more information.
voice your opinion now!
java implement quercus library interpreter benefit
DevShed: Creating a Blog Application with Interpreter Classes with PHP 5
by Chris Cornutt April 16, 2007 @ 11:53:00
DevShed has posted the final part of their look at working with the Interpreter pattern and its use in a PHP5 application with the creation of a simple blogging application.
As you can see, the logic that drives the interpreter pattern is rather easy to understand and implement with functional PHP code. Therefore, in this final installment of the series, I'm going to demonstrate how to get the most out of this handy pattern by developing a highly expansible blogging application. The application will be able to insert, update and delete blog entries, using a simple MySQL database as backend.
They start off with the creation of the MySQL class that will interface with the database backend for the application. Also included is a Result class to fetch the results from each query. On top of these, they create the Blog class to handle the requests for information and a BlogHandler class to push the submitted data back into the database.
Finally, they wrap it all together and give a real-life example of it in action, inserting new blog information and making an update of the content on one.
voice your opinion now!
designpattern interpreter tutorial blog application designpattern interpreter tutorial blog application
DevShed: Building Interpreter Classes with PHP 5
by Chris Cornutt April 03, 2007 @ 10:32:00
DevShed is starting off another design pattern series with part one of their look at the interpreter pattern - commonly used along with the Composite pattern to create more modular applications.
In this series, which is comprised of three articles, I'll provide you with numerous code samples showing how to implement this useful pattern, ranging from building a simple application for managing user information to creating a decent blogger.
As mentioned, their goal is to create a simple blogging application (eventually), but for now they just need to lay the foundation. They start with an introduction to the pattern via the creation of the User and UserServer classes. Next up is the creation of the UserInterpreter class to handle the requests and pass them along to the UserSaver. Finally, they show it in use, saving inputted user information into an array.
voice your opinion now!
designpattern interpreter class php5 tutorial basics designpattern interpreter class php5 tutorial basics
|
Community Events
Don't see your event here? Let us know!
|