main website home
  • About this blog

    This blog features updates, opinions, and technical notes from Caucho engineers about Caucho products, the enterprise Java industry, and PHP. Caucho Technology is the creator of the Resin Application Server and the Quercus PHP in Java engine. A leader in Java performance since 1998, Caucho is a Sun JavaEE licensee with over 9000 customers worldwide.
  • Tags

    ajaxworld bam candi cdi cloud cluster comet configuration deploy devoxx eclipse ejb embedded flash flex google app engine hessian hmtp ioc java ee 6 javaone javazone jms messaging newsletter nyjug osgi php pomegranate quercus resin resin 4.0 REST servlet sfjug silicon valley code camp spring testing training tssjs watchdog webbeans web profile websockets wordpress
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
« Quercus on Google App Engine - 2.0
Resin PDF Health Reports »

Quercus, meet PHP 5.4 and shake hands, please

I just extended Quercus to support the new core language features of PHP 5.4. The changes are currently in our subversion repository and should be in our next release: 4.0.34. Traits, new in 5.4, was a bit of a pain to implement because of all the weird edge cases (i.e. __CLASS__, insteadof, as). Here’s a list of what’s new:

  • traits
    <?php
    
    trait T0 {
      function foo()
      {
        echo "inside T0->foo()\n";
      }
    }
    
    class A {
      use T0;
    }
    
    $a = new A();
    $a->foo();
    
    ?>
    
  • short array syntax
    <?php
    
    $a = ["a" => 123, "b" => 456];
    
    ?>
    
  • function array dereferencing
    <?php
    
    $a[0]();
    
    ?>
    
  • $this use in closures
    <?php
    
    class A {
      var $foo = 123;
    
      function test() {
        $fun = function() {
          var_dump($this->foo);
        };
    
        $fun();
      }
    }
    
    $a = new A();
    $a->test();
    
    ?>
    
  • <?= short open tag is now always on
    <?php
    
      $hello = "hello world";
    
    ?>
    <b><?= $hello ?></b>
    
  • class member access on instantiation
    <?php
    
    class A
    {
      function foo()
      {
        echo "inside A->foo()\n";
      }
    }
    
    (new A())->foo();
    
    ?>
    
  • Class::{expr}() syntax
    <?php
    
    class A
    {
      static function foo()
      {
        echo "inside A::foo()\n";
      }
    }
    
    $name = "foo";
    A::{$name}();
    
    ?>
    
  • binary number format: 0b001001101
    <?php
    
    // int(7)
    var_dump(0b111);
    
    ?>
    
  • $_SERVER['REQUEST_TIME_FLOAT'] is populated
    <?php
    
    // returns a float (i.e. float(1356829982.6495))
    var_dump($_SERVER['REQUEST_TIME_FLOAT']);
    
    ?>
    

And for those that are still with me, I’m aiming to have PHP 5.5 support in our 4.0.35 release :).

– Nam

Nam Nguyen is a Software Engineer at Caucho Technology in San Diego/San Francisco. He is currently the lead for the Quercus project.

Tags: php 5.4, quercus, traits

This entry was posted on Saturday, December 29th, 2012 at 7:27 pm and is filed under Announcements, Engineering. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

2 Responses to “Quercus, meet PHP 5.4 and shake hands, please”

  1. jsnoriegam Says:
    April 27th, 2013 at 10:39 am

    Hello i was trying to run an app developed on fuelphp and i noticed that php 5.3 class_alias function was not implemented, why is that?

    will it be implemented in the future?

    Thanks.

  2. nam Says:
    May 16th, 2013 at 5:31 am

    Hi,

    I filed a bug report for it at:
    http://bugs.caucho.com/view.php?id=5443

    We should be implementing it shortly. Thanks.

Leave a Reply

You must be logged in to post a comment.


Caucho Technology is proudly powered by WordPress and Quercus®
Entries (RSS) and Comments (RSS).

  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • BLOG |
  • WIKI 4 |
  • WIKI 3 |
  • Resin: Java Application Server
Copyright (c) 1998-2012 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.
resin® is a cloud optimized, java® application server that supports the java ee webprofile ®