Friday, July 20, 2012

PHP/ Java Bridge

There are three well known implementations of the PHP scripting language:

v The original implementation of PHP and the de facto standard is the open source PHP distribution.
v Project Zero has a PHP runtime written in Java. It also distributes extensions from the open source implementation of PHP.
v Quercus is an open-source pure Java implementation of the PHP scripting language.

To bridge between PHP scripts and Java libraries all three implementations provide a PHP/Java bridge.

The de facto implementation of PHP has a PHP/Java Bridge separately available from SourceForge. This uses a dual process model where the Java libraries are run in a separate process from the PHP runtime. Interactions with Java objects are marshalled across to the Java process using an XML protocol.

Quercus and Project Zero implement PHP on top of the Java Virtual Machine and so can run the Java libraries in the same process as the PHP runtime. This reduces the overhead of interacting with Java libraries when compared with the dual process model.

See also

v Quercus (software)

External links

v Open source PHP homepage
v SourceForge PHP/Java Bridge homepage
v Project Zero homepage
v Quercus homepage


1.      http:/ / php-java-bridge. sourceforge. net/ pjb/ PROTOCOL. TXT
2.      http:/ / www. php. net/
3.      http:/ / php-java-bridge. sourceforge. net/
4.      http:/ / www. projectzero. org/ documentation/
5.      http:/ / quercus. caucho. com/

PHP Syntax and Semantics

The syntax of the PHP programming language is the set of rules that defines how a PHP program will be written and interpreted.


PHP only parses code within its delimiters. Anything outside its delimiters is sent directly to the output and not parsed by PHP. The most common delimiters are <?php and ?>, respectively open and close delimiters. <script language="php"> </script> style delimiters are also always available, so these two forms are the most portable. The first form of delimiters, <?php and ?>, in XHTML and other XML documents, creates correctly formed XML 'processing instructions'. Therefore, in either of these two cases, the resulting mixture of PHP and other markup is well-formed, and so probably valid, as XML and XHTML on the server before PHP processing. This may be helpful if the source code documents ever need to be processed in other ways during the life of the software.

Short opening tags (<? or <?=) are also available for use, but are, along with ASP style tags (<% or <%=), less portable as they can be disabled in the PHP configuration. For this reason the use of Short tags and ASP style tags is discouraged. The purpose of these delimiters is to separate PHP code from non-PHP code (notably HTML). Everything outside the delimiters is ignored by the parser and is passed through as output. One of the language characteristic features is implicit variable declaration. Variables are prefixed with a dollar symbol and a type does not need to be specified in advance. Unlike function and class names, variable names are case sensitive. Both double-quoted ("") and heredoc strings allow the ability to embed a variable's value into the string. PHP treats newlines as whitespace, in the manner of a free-form language (except when inside string quotes). Statements are terminated by a semicolon. PHP has three types of comment syntax: /* */ which serves as block comments, and // as well as # which are used for inline comments. Many examples use the print function instead of the echo function. Both functions are nearly identical; the major difference being that print is slower than echo because the former will return a status indicating if it was successful or not in addition to text to output, whereas the latter does not return a status and only returns the text for output.

The usual Hello World code example for PHP is:
echo "Hello World!\n";

The example above outputs the following:

Hello World!

Instead of using <? and the echo statement an optional "shortcut" is the use of <?= instead of <? which implicitly echoes data:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"

Colon Syntax

PHP offers an alternative syntax to the standard curly-brace syntax. This syntax is called colon syntax and affects the following control structures: if, while, for, foreach, and switch. The syntax varies only slightly from the curly-brace syntax. In each case the opening brace ({) is replaced with a colon (:) and the close brace is replaced with endif;, endwhile;, endfor;, endforeach;, or endswitch;, respectively. An example of the syntax for an if/elseif statment is as follows:

if (condition) :
// code here
elseif (condition) :
// code here
else :
// code here

Data types

PHP stores whole numbers in a platform-dependent range. This range is typically that of 32-bit signed integers. Integer variables can be assigned using decimal (positive and negative), octal and hexadecimal notations. Real numbers are also stored in a platform-specific range. They can be specified using floating point notation, or two forms of scientific notation. PHP has a native Boolean type, named "boolean", similar to the native Boolean types in Java and C++. Using the Boolean type conversion rules, non-zero values are interpreted as true and zero as false, as in Perl. The null data type represents a variable that has no value. The only value in the null data type is NULL. Variables of the "resource" type represent references to resources from external sources. These are typically created by functions from a particular extension, and can only be processed by functions from the same extension. Examples include file, image and database resources. Arrays can contain elements of any type that PHP can handle, including resources, objects, and even other arrays. Order is preserved in lists of values and in hashes with both keys and values, and the two can be intermingled. Objects can syntactically be used as Arrays.


PHP has hundreds of base functions and thousands more from extensions. Functions are not first-class functions and can only be referenced by their name prior to PHP version 5.3.0, whereas PHP 5.3.0 introduces closures. User-defined functions can be created at any time and without being prototyped. Functions can be defined inside code blocks, permitting a run-time decision as to whether or not a function should be defined. There is no concept of local functions. Function calls must use parentheses with the exception of zero argument class constructor functions called with the PHP new operator, where parentheses are optional.

An example function definition is the following:

function hello()
echo "Hello World!\n";

PHP supports quasi-anonymous functions through the create_function() function. These are not true anonymous functions because anonymous functions are nameless but functions can only be referenced by name in PHP. As of version 5.3, PHP also supports anonymous functions.

Function calls may be made via variables, where the value of a variable contains the name of the function to call.

This is illustrated in the following example:

function hello()
return 'Hello';
function world()
return "World!\n";
$fn1 = 'Hello';
$fn2 = 'World';
echo $fn1 . world() . ' ' . hello() . $fn2;

PHP does not support named parameters or parameter skipping. Some core PHP developers have publicly expressed disappointment with this decision. Others have suggested workarounds for this limitation.


Basic object-oriented programming functionality was added in PHP 3. Object handling was completely rewritten for PHP 5, expanding the feature set and enhancing performance. In previous versions of PHP, objects were handled like primitive types. The drawback of this method was that the whole object was copied when a variable was assigned or passed as a parameter to a method. In the new approach, objects are referenced by handle, and not by value. PHP 5 introduced private and protected member variables and methods, along with abstract classes and final classes as well as abstract methods and final methods. It also introduced a standard way of declaring constructors and destructors, similar to that of other object-oriented languages such as C++, and a standard exception handling model. Furthermore PHP 5 added Interfaces and allows for multiple Interfaces to be implemented. There are special interfaces that allow objects to interact with the runtime system. Objects implementing ArrayAccess can be used with array syntax and objects implementing Iterator or IteratorAggregate can be used with the foreach language construct. The static method and class variable features in Zend Engine 2 do not work the way some would expect. There is no virtual table feature in the engine, so static variables are bound with a name instead of a reference at compile time.

This example shows how to define a class, foo, that inherits from class bar. The function mystaticfunc is a public static function that can be called with foo::mystaticfunc();.

class foo extends bar
   function __construct()
    $doo = "wah dee dee";
    public static function mystaticfunc()
     $dee = "dee dee dum";

If the developer creates a copy of an object using the reserved word clone, the Zend engine will check if a __clone() method has been defined or not. If not, it will call a default __clone() which will copy the object's properties. If a __clone() method is defined, then it will be responsible for setting the necessary properties in the created object. For convenience, the engine will supply a function that imports the properties of the source object, so that the programmer can start with a by-value replica of the source object and only override properties that need to be changed.


1.      Bray, Tim; et al (26 November 2008). "Processing Instructions" (http:/ / www. w3. org/ TR/ 2008/ REC-xml-20081126/ #sec-pi). Extensible Markup Language (XML) 1.0 (Fifth Edition). W3C. . Retrieved 2009-06-18.
2.      "PHP: Basic syntax" (http:/ / www. php. net/ manual/ en/ language. basic-syntax. php). The PHP Group. . Retrieved 2008-02-22.
3.      "Your first PHP-enabled page" (http:/ / ca3. php. net/ manual/ en/ tutorial. firstpage. php). The PHP Group. . Retrieved 2008-02-25.
4.      "Variables" (http:/ / www. php. net/ manual/ en/ language. variables. php). The PHP Group. . Retrieved 2008-03-16.
5.      "Instruction separation" (http:/ / www. php. net/ basic-syntax. instruction-separation). The PHP Group. . Retrieved 2008-03-16.
6.      "Comments" (http:/ / ca3. php. net/ manual/ en/ language. basic-syntax. comments. php). The PHP Group. . Retrieved 2008-03-16.
7.      "print" (http:/ / www. php. net/ print). The PHP Group. . Retrieved 2008-03-16.
8.      "Hello World" (http:/ / php. codenewbie. com/ articles/ php/ 1485/ Hello_World-Page_1. html). Code Newbie. . Retrieved 2008-02-25.
9.      "Colon Syntax in PHP" (http:/ / www. kwista. com/ programming/ colon-syntax-in-php/ ). Kwista, LLC.. . Retrieved 2010-04-19.
10.  "Alternative syntax for control structures" (http:/ / php. net/ manual/ en/ control-structures. alternative-syntax. php). The PHP Group. . Retrieved 2010-04-16.
11.  "Types" (http:/ / www. php. net/ manual/ en/ language. types. php). The PHP Group. . Retrieved 2008-03-16.
12.  "Functions" (http:/ / www. php. net/ manual/ en/ language. functions. php). The PHP Group. . Retrieved 2008-03-16.
13.  "PHP 6 Dropped Items" (http:/ / wiki. php. net/ todo/ backlog#dropped_items). The PHP Group. . Retrieved 2009-01-09.
14.  "PHP Skipped and Named Parameters" (http:/ / www. seoegghead. com/ software/ php-parameter-skipping-and-named-parameters. seo). SEO Egghead Inc.. . Retrieved 2009-01-09.
15.  "History of PHP and related projects" (http:/ / www. php. net/ history). The PHP Group. . Retrieved 2008-02-25.
16.  "PHP 5 Object References" (http:/ / mjtsai. com/ blog/ 2004/ 07/ 15/ php-5-object-references/ ). mjtsai. . Retrieved 2008-03-16.
17.  "Classes and Objects (PHP 5)" (http:/ / ca3. php. net/ zend-engine-2. php). The PHP Group. . Retrieved 2008-03-16.
18.  "Object cloning" (http:/ / ca3. php. net/ language. oop5. cloning). The PHP Group. . Retrieved 2008-03-16.


 The Joomla Core Team [1]
Stable release
 1.5.18 Wojmamni ama wojnaiki / May 28, 2010
Preview release
1.6 Beta 3[2] / June 14, 2010
Development status
Written in
Operating system
 6.4 MB (archived)
 Content management system
 GNU General Public License
 http:/ / www. joomla. org/

Joomla! is an open source content management system platform for publishing content on the World Wide Web and intranets as well as a Model–view–controller (MVC) Web application framework. It is written in PHP, stores data in MySQL and includes features such as page caching, RSS feeds, printable versions of pages, news flashes, blogs, polls, search, and support for language internationalization. Within its first year of release, Joomla was downloaded 2.5 million times. Over 5,000 free and commercial plug-ins are available for Joomla.[3]


Joomla! was the result of a fork of Mambo by the Joomla! development team on August 17, 2005. At that time, the Mambo name was trademarked by Miro International Pty Ltd, who formed a non-profit foundation with the stated purpose to fund the project and protect it from lawsuits.[4] The Joomla! development team claimed that many of the provisions of the foundation structure went against previous agreements made by the elected Mambo Steering Committee, lacked the necessary consultation with key stake-holders and included provisions that violated core open source values.[5]

The Joomla! development team created a web site called to distribute information to users, developers, web designers and the community in general. The project team leader Andrew Eddie, AKA "MasterChief" wrote an open letter to the community[6] which appeared on the announcements section of the public forum at

A little more than one thousand people had joined the web site within a day, most posting words of encouragement and support, and the web site received the slashdot effect as a result. Miro CEO Peter Lamont gave a public response to the development team in an article titled "The Mambo Open Source Controversy - 20 Questions With Miro".[7] This event created controversy within the free software community about the definition of "open source". Forums at many other open source projects were active with postings for and against the actions of both sides.

In the two weeks following Eddie's announcement, teams were re-organized, and the community continued to grow. Eben Moglen and the Software Freedom Law Center (SFLC) assisted the Joomla! core team beginning in August 2005, as indicated by Moglen's blog entry from that date and a related OSM announcement.[8] [9] The SFLC continue to provide legal guidance to the Joomla! project.[10]

On August 18, 2005, Andrew Eddie called for community input on suggested names for the project. The core team indicated that it would make the final decision for the project name based on community input. The core team eventually chose a name that was not on the list of suggested names provided by the community. On September 1, 2005 the new name, “Joomla!,” was announced. It is the English spelling of the Swahili word jumla meaning “all together” or “as a whole.”[11]

On September 6, 2005, the development team called for logo submissions from the community, invited the community to vote on the logo preferred, and announced the community's decision on September 22, 2005. Following the logo selection, brand guidelines, a brand manual, and a set of logo resources were then published on October 2, 2005 for the community's use.[12]

Joomla! (Joomla 1.0.0) was released on September 16, 2005. It was a re-branded release of Mambo which, itself, was combined with other bug and moderate-level security fixes.

Joomla! won the Packt Publishing Open Source Content Management System Award in both 2006 and 2007.[13] [13] On October 27, 2008, PACKT Publishing announced Johan Janssens the "Most Valued Person" (MVP) for his work as one of the lead developers of the 1.5 Joomla Framework and Architecture. In 2009 Louis Landry received the "Most Valued Person" award for his role as Joomla architect and development coordinator.

Joomla! version 1.5 was released on January 22, 2008. The most recent release (28 May 2010) is 1.5.18.[14] In May and June 2010, beta versions of 1.6 were made available for testing purposes.


Joomla can be installed manually from source code on a system running a web server which supports PHP applications. Manual installation usually requires more time and experience than other alternatives such as installing Joomla from a package management system or using a TurnKey Joomla appliance which pre-integrates Joomla and its dependencies as a ready-to-use system[15] .

There are numerous web hosting companies who provide a control panel which automates the deployment of a basic Joomla web site.

Joomla can also be installed via the Microsoft Web Platform Installer which installs Joomla on Windows and IIS. The Web PI will automatically detect any missing dependencies such as PHP or MySQL then install and configure them[16] before installing Joomla.

See also

v Drupal
v List of content management systems:PHP
v WordPress


v Severdia, Ron; Crowder, Kenneth (2009), Using Joomla: Building Powerful and Efficient Web Sites, O'Reilly Media, ISBN 0596804946
v Jowers, Tim (2007), Open Source Pro: Joomla,, ISBN 1430306386


1)     http:/ / Joomla. org/

2)     Joomla 1.6 Beta 3 Now Available (http:/ / www. joomla. org/ announcements/ release-news/ 5279-joomla-16-beta3-now-available. html). 14 June 2010. Retrieved 16 June 2010

3)     Dan Rahmel. Beginning Joomla! (Second ed.). pp. 2–5. ISBN 978-1-4302-1643-8.

4)     "Mambo Foundation web site, Goals and objectives" (http:/ / www. mambo-foundation. org). 2006-01-09. . Retrieved 2007-03-14.

5)     "Joomla Forum Discussion by Development Team members and Community" (http:/ / forum. joomla. org/ index. php/ topic,73. 0. html). 2007-05-07. . Retrieved 2007-05-07.

6)     Andrew Eddie (2005-08-17). "Mambo Open Source Development Team - Letter to the community" (http:/ / forum. mamboserver. com/ showthread. php?t=57645). . Retrieved 2009-08-31.

7)     Ric Shreves (2005-08-21). "The Mambo Open Source Controversy - 20 Questions With Miro".

8)     Moglen, Eben (August 2005). "Why I like Open Source Matters (was Why I Like Mambo)" (http:/ / emoglen. law. columbia. edu/ blog/ 2005/ 08/ index. html). . Retrieved 2008-10-08.

9)     Russell, Peter (2005). "Award-winning Development Team Welcomes New Arrival — Joomla!" (http:/ / www. opensourcematters. com/ index. php?option=com_content& task=view& id=41& Itemid=1). . Retrieved 2008-10-08.

10)      Open Source Matters • Joomla! Main Descriptive Page (http:/ / opensourcematters. org/ joomla. html)

11)      Open Source Matters, Inc (undated). "Partners" (http:/ / www. joomla. org/ content/ view/ 40/ 41/ ). . Retrieved 2008-10-08.

12)      Open Source Matters, Inc (2008). "Logo Usage and Brand Guide" (http:/ / www. joomla. org/ about-joomla/ the-project/

13)      logo-usage-and-brand-guide. html). . Retrieved 2008-10-08.

14)      "2006 Open Source Content Management System Award Winner Announced" (http:/ / www. packtpub. com/ article/

15)      open-source-content-management-system-award-winner-announced). Packt Publishing. 2006-11-14. . Retrieved 2007-03-08.

16)      View the full 1.5. version history. (http:/ / docs. joomla. org/ Joomla_1. 5_version_history)

17)      "Joomla Appliance" (http:/ / www. turnkeylinux. org/ joomla). TurnKey Linux Virtual Appliance Library. . Retrieved 2009-12-11."The Easy Way To Install PHP on Windows" (http:/ / articles. sitepoint. com/ article/ php-windows-web-platform-installer). SitePoint. . Retrieved 2009-11-20.

External links

v Official website (http:/ / www. joomla. org)