SlideShare una empresa de Scribd logo
1 de 20

      
       PHP on Java 
      
     
      
       ,[object Object],
      
     
      
       Robin Fernandes   (ibm) 
       [email_address] 
       @rewbs

      
       PHP ? 
      
     
      
       “ PHP isn't so much a language as a   virtual explosion  at the  keyword and function factory .” 
       - Jeff Atwood 
       from “PHP sucks, but it doesn't matter”

      
       PHP ? 
      
     
      
       in_array( $needle ,  $haystack ); 
       strpos( $haystack ,  $needle ); 
      
     
      
       ... 
       IteratorIterator 
       RecursiveIterator 
       RecursiveIteratorIterator 
       ... 
      
     
      
       strip _ tags() 
       strip s lashes() 
       SDO _ Model _ Property::get C ontaining T ype() 
      
     
      
       ReflectionClass::isItera tea ble()

      
       PHP ! 
      
     
      
       
       
      
     
      
       
      
     
      
       
      
     
      
       
      
     
      
       
      
     
      
       
      
     
      
       
      
     
      
       
      
     
      
       tiobe.com

      
       PHP ! 
      
     
      
       
       
      
     
      
       
      
     
      
       Photo from  DragonBe

      
       PHP !

      
       Why  integrate PHP and Java?  
      
     
      
       
       
      
     
      
       ,[object Object],
       
       “ Pay special attention to opportunities to use  PHP in combination with Java  development efforts” 
      
     
      
       ,[object Object],

      
       Why  run PHP  on the  JVM ?  
      
     
      
       
       
      
     
      
       ,[object Object],
       
       PHP + JVM =  ♥

      
       How  PHP  runs on the  JVM 
      
     
      <?php 
      echo  'hello' ; 
      
       
       
       
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      System. out .println( &quot;hello&quot; );

      
       How  PHP  runs on the  JVM 
      
     
      
       ,[object Object],
      
     
      
       ,[object Object],
      
     
      
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      P8 Runtime 
      
     
      SAPI-J 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      Parser 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      Interpreter 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      P8 Engine 
      
     
      Java  
      Extensions 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      C 
      Extensions 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      Stack 
      
     
      Resources 
      
     
      Classes 
      
     
      Objects 
      
     
      Variables 
      
     
      AST 
      
     
      XAPI-J 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      XAPI-C 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      Native  
      code 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      Compiler 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      .class 
      
       
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      opcodes 
      
     
      Cache 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      Persistent 
      class cache 
      
     
      
       
       
        
        
        
        
        
        
        
        
        
        
        
        
       
      
      
       Debug API  (DBGp) 
       
      
     
      
       
       
        
        
        
        
        
        
        
        
        
        
        
        
       
      
      
       Runtime

      
       Some  Code ! 
      
     
      <?php 
      java_import( &quot;java.util.HashMap&quot; ); 
      $map  =  new  HashMap; 
      
      $map ->put( &quot;stuff&quot; ,  array ( 1 , 2 , 3 , 4 , 5 )); 
      var_dump( $map ->get( &quot;stuff&quot; )); 
      // prints: array(5) { ...

      
       Some more  Code ! 
      
     
      <?php 
      java_import( &quot;java.io.File&quot; ); 
      
      class  SubFile  extends  File { 
      function  isThisCool() { 
      return TRUE ;  // Way cool 
      } 
      } 
      
      $file  =  new  SubFile( &quot;/&quot; ); 
      var_dump( $file ->isDirectory()); 
      var_dump( $file ->isThisCool());

      
       Last bit of  Code ! 
      
     
      <?php 
      java_import( &quot;java.util.ArrayList&quot; ); 
      
      $list  =  new  ArrayList(); 
      $list ->add( &quot;Hello World!&quot; ); 
      $list ->add( FALSE ); 
      $list ->add( 1234567890 ); 
      
      foreach  ( $list  as  $key  =>  $value ) { 
      echo  &quot; $key   $value &quot; ; 
      }

      
       PHP apps  +  Java libraries 
      
     
      
       ,[object Object],

      
       Java apps  +  PHP scripting 
      
     
      
       
       
      
     
      
       ,[object Object],

      
       PHP in  WebSphere sMash 
      
     
      
       
       
      
     
      
       ,[object Object],
      
     
      
       
      
     
      
       
      
     
      
       ,[object Object],
      
     
      
       
      
     
      JVM 
      
      
      
      
      
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      Web Server 
      
     
      Application Code 
      
     
      Language Runtimes

      
       Sorry, one more bit of   Code ! 
      
     
      
       
      
     
      
       
      
     
      class Dynamic { 
      def  storage = [:] 
      def  invokeMethod(String name, args) { 
      println   &quot;Hello!&quot; 
      } 
      def  getProperty(String name) {  
      storage[name]  
      } 
      def  setProperty(String name, value) {  
      storage[name] = value  
      } 
      } 
      
     
      <?php 
      groovy_import( &quot;dynamic.groovy&quot; ); 
      $foo  =  new  Dynamic(); 
      $foo ->bar(); 
      $foo ->guff =  &quot;Hello World!&quot; ; 
      echo  $foo ->guff;

      
       PHP in  Message Broker 
      
     
      
       
       
      
     
      
       
       
      
     
      
       ,[object Object],

      
       PHP in  CICS 
      
     
      
       
       
      
     
      
       ,[object Object],
      
     
      
       
      
     
      
       
      
     
      Transaction Server 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      CICS assets: 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      RESTful API 
      to CICS assets  
      
     
      SupportPac CA1S 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      ... 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      DB2 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      COBOL 
      
       
       
       
       
       
       
       
       
       
       
       
       
      
     
      Java

      
       Learn  more & Try  it out: 
      
     
      
       
       
      
     
      
       
       
       http://projectzero.org/php 
      
     
      
       Thanks! 
       [email_address]   /  @rewbs

Más contenido relacionado

Similar a PHP on Java (BarCamp London 7)

Phalcon / Zephir Introduction at PHPConfTW2013
Phalcon / Zephir Introduction at PHPConfTW2013Phalcon / Zephir Introduction at PHPConfTW2013
Phalcon / Zephir Introduction at PHPConfTW2013
Rack Lin
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
Li SUN
 
Florian adler minute project
Florian adler   minute projectFlorian adler   minute project
Florian adler minute project
Dmitry Buzdin
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
FuseSource.com
 
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Alexandre Morgaut
 
What is new and cool j2se & java
What is new and cool j2se & javaWhat is new and cool j2se & java
What is new and cool j2se & java
Eugene Bogaart
 

Similar a PHP on Java (BarCamp London 7) (20)

Project Zero JavaOne 2008
Project Zero JavaOne 2008Project Zero JavaOne 2008
Project Zero JavaOne 2008
 
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...
IBM IMPACT 2009 Conference Session 2078 - Extending and Integrating Popular P...
 
An Introduction to Websphere sMash for PHP Programmers
An Introduction to Websphere sMash for PHP ProgrammersAn Introduction to Websphere sMash for PHP Programmers
An Introduction to Websphere sMash for PHP Programmers
 
Phalcon / Zephir Introduction at PHPConfTW2013
Phalcon / Zephir Introduction at PHPConfTW2013Phalcon / Zephir Introduction at PHPConfTW2013
Phalcon / Zephir Introduction at PHPConfTW2013
 
IBM IMPACT 2009 Conference Session 2024 - WebSphere sMash Integration, PHP wi...
IBM IMPACT 2009 Conference Session 2024 - WebSphere sMash Integration, PHP wi...IBM IMPACT 2009 Conference Session 2024 - WebSphere sMash Integration, PHP wi...
IBM IMPACT 2009 Conference Session 2024 - WebSphere sMash Integration, PHP wi...
 
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416Avro - More Than Just a Serialization Framework - CHUG - 20120416
Avro - More Than Just a Serialization Framework - CHUG - 20120416
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
 
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
 
Project Zero Php Quebec
Project Zero Php QuebecProject Zero Php Quebec
Project Zero Php Quebec
 
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012
Wakanda: NoSQL & SSJS for Model-driven Web Applications - SourceDevCon 2012
 
DevOps for Developers
DevOps for DevelopersDevOps for Developers
DevOps for Developers
 
Florian adler minute project
Florian adler   minute projectFlorian adler   minute project
Florian adler minute project
 
Dev ops for developers
Dev ops for developersDev ops for developers
Dev ops for developers
 
Turbo charging v8 engine
Turbo charging v8 engineTurbo charging v8 engine
Turbo charging v8 engine
 
Introduction to Apache Camel
Introduction to Apache CamelIntroduction to Apache Camel
Introduction to Apache Camel
 
Guidelines php 8 gig
Guidelines php 8 gigGuidelines php 8 gig
Guidelines php 8 gig
 
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
Wakanda: NoSQL for Model-Driven Web applications - NoSQL matters 2012
 
What is new and cool j2se & java
What is new and cool j2se & javaWhat is new and cool j2se & java
What is new and cool j2se & java
 
Na pomezi php a vue.js
Na pomezi php a vue.jsNa pomezi php a vue.js
Na pomezi php a vue.js
 
Web Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptxWeb Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptx
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 

PHP on Java (BarCamp London 7)

  • 1.
  • 2. PHP ? “ PHP isn't so much a language as a virtual explosion at the keyword and function factory .” - Jeff Atwood from “PHP sucks, but it doesn't matter”
  • 3. PHP ? in_array( $needle , $haystack ); strpos( $haystack , $needle ); ... IteratorIterator RecursiveIterator RecursiveIteratorIterator ... strip _ tags() strip s lashes() SDO _ Model _ Property::get C ontaining T ype() ReflectionClass::isItera tea ble()
  • 4. PHP ! tiobe.com
  • 5. PHP ! Photo from DragonBe
  • 6. PHP !
  • 7.
  • 8.
  • 9. How PHP runs on the JVM <?php echo 'hello' ; System. out .println( &quot;hello&quot; );
  • 10.
  • 11. Some Code ! <?php java_import( &quot;java.util.HashMap&quot; ); $map = new HashMap; $map ->put( &quot;stuff&quot; , array ( 1 , 2 , 3 , 4 , 5 )); var_dump( $map ->get( &quot;stuff&quot; )); // prints: array(5) { ...
  • 12. Some more Code ! <?php java_import( &quot;java.io.File&quot; ); class SubFile extends File { function isThisCool() { return TRUE ; // Way cool } } $file = new SubFile( &quot;/&quot; ); var_dump( $file ->isDirectory()); var_dump( $file ->isThisCool());
  • 13. Last bit of Code ! <?php java_import( &quot;java.util.ArrayList&quot; ); $list = new ArrayList(); $list ->add( &quot;Hello World!&quot; ); $list ->add( FALSE ); $list ->add( 1234567890 ); foreach ( $list as $key => $value ) { echo &quot; $key $value &quot; ; }
  • 14.
  • 15.
  • 16.
  • 17. Sorry, one more bit of Code ! class Dynamic { def storage = [:] def invokeMethod(String name, args) { println &quot;Hello!&quot; } def getProperty(String name) { storage[name] } def setProperty(String name, value) { storage[name] = value } } <?php groovy_import( &quot;dynamic.groovy&quot; ); $foo = new Dynamic(); $foo ->bar(); $foo ->guff = &quot;Hello World!&quot; ; echo $foo ->guff;
  • 18.
  • 19.
  • 20. Learn more & Try it out: http://projectzero.org/php Thanks! [email_address] / @rewbs