<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 21 May 2013 18:49:34 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[DZone.com: Running JavaScript inside PHP code]]></title>
      <guid>http://www.phpdeveloper.org/news/17609</guid>
      <link>http://www.phpdeveloper.org/news/17609</link>
      <description><![CDATA[<p>
On DZone.com <i>Giorgio Sironi</i> has a new post about an interesting new PHP extension that <a href="http://css.dzone.com/articles/running-javascript-inside-php">lets you run javascript inside PHP</a> - v8js (VERY alpha right now).
</p>
<blockquote>
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.
</blockquote>
<p>
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 <a href="http://www.codinghorror.com/blog/2007/02/fizzbuzz-the-programmers-stairway-to-heaven.html">FizzBuzz</a> 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.
</p>]]></description>
      <pubDate>Thu, 01 Mar 2012 09:56:45 -0600</pubDate>
    </item>
  </channel>
</rss>
