PHP Programming Language - Cultural View
PHP Programming Language - Cultural View PHP Programming Language - Cultural View
PHP 200 Basic example of object-oriented programming as described above: Class Person { } public $first; public $last; public function construct($f,$l) { } $this->first = $f; $this->last = $l; public function greeting() { } return "Hello, my name is {$this->first} {$this->last}."; public function staticGreeting($first, $last) { } return "Hello, my name is $first $last."; $him = new Person('John','Smith'); $her = new Person('Sally','Davis'); echo $him->greeting(); // prints "Hello, my name is John Smith." echo ''; echo $her->greeting(); // prints "Hello, my name is Sally Davis." echo ''; echo Person::staticGreeting('John','Smith'); // prints "Hello, my name is John Smith."
PHP 201 Speed optimization PHP source code is compiled on-the-fly to an internal format that can be executed by the PHP engine. [68] [69] In order to speed up execution time and not have to compile the PHP source code every time the webpage is accessed, PHP scripts can also be deployed in executable format using a PHP compiler. Code optimizers aim to reduce the runtime of the compiled code by reducing its size and making other changes that can reduce the execution time with the goal of improving performance. The nature of the PHP compiler is such that there are often opportunities for code optimization, [70] and an example of a code optimizer is the eAccelerator PHP extension. [71] Another approach for reducing overhead for high load PHP servers is using an opcode cache. Opcode caches work by caching the compiled form of a PHP script (opcodes) in shared memory to avoid the overhead of parsing and compiling the code every time the script runs. An opcode cache, APC, will be built into an upcoming release of PHP. [72] Opcode caching is also available in Zend Server Community Edition. Compilers The PHP language was originally implemented using a PHP interpreter. Several compilers now exist, which decouple the PHP language from the interpreter: • phc [73] - a C++ based compiler for PHP, using the Zend run-time for maximum compatibility • Roadsend - achieves native compilation by compiling to bigloo scheme, which in turn is compiled to C, then to machine code • Raven [74] - a rewrite of Roadsend PHP (rphp), based on LLVM and a new C++ runtime • Phalanger - compiles source code written in the PHP scripting language into CIL byte-code • Caucho Resin/Quercus [75] - compiles PHP to Java bytecode • HipHop - developed at Facebook and now available as open source, transforms the PHP Script into C++, then compiles it. • php-to-scala [76] - converts PHP to human-readable Scala source code, which the developer can compile to Java bytecode Advantages of compilation include not only better execution speed, but also obfuscation, static analysis, and improved interoperability with code written in other languages. [77] Resources PHP includes free and open source libraries with the core build. PHP is a fundamentally Internet-aware system with modules built in for accessing FTP servers, many database servers, embedded SQL libraries such as embedded PostgreSQL, MySQL and SQLite, LDAP servers, and others. Many functions familiar to C programmers such as those in the stdio family are available in the standard PHP build. [78] PHP allows developers to write extensions in C to add functionality to the PHP language. These can then be compiled into PHP or loaded dynamically at runtime. Extensions have been written to add support for the Windows API, process management on Unix-like operating systems, multibyte strings (Unicode), cURL, and several popular compression formats. Some more unusual features include integration with Internet Relay Chat, dynamic generation of images and Adobe Flash content, and even speech synthesis. The PHP Extension Community Library (PECL) project is a repository for extensions to the PHP language. [79] Zend provides a certification exam for programmers to become certified PHP developers.
- Page 155 and 156: Ning (website) 149 Feature modifica
- Page 157 and 158: Ning (website) 151 [11] http://blog
- Page 159 and 160: NolaPro 153 In May 2005, NolaPro wa
- Page 161 and 162: ocPortal 155 ocPortal Developer(s)
- Page 163 and 164: ocPortal 157 Version history • Ma
- Page 165 and 166: Open Realty 159 References [1] Open
- Page 167 and 168: Opus (content management system) 16
- Page 169 and 170: osCommerce 163 osCommerce Developer
- Page 171 and 172: osCommerce 165 Branches Distributed
- Page 173 and 174: PEAR 167 External links • The PEA
- Page 175 and 176: PHP syntax and semantics 169 Colon
- Page 177 and 178: PHP syntax and semantics 171 } { $d
- Page 179 and 180: PHPClasses repository 173 PHPClasse
- Page 181 and 182: PHPDoc 175 markup for display forma
- Page 183 and 184: PHPDoc 177 The text that marks this
- Page 185 and 186: PHPDoc 179 @static Documents a stat
- Page 187 and 188: PHPEclipse 181 Further reading •
- Page 189 and 190: User:Papagel/EFront (eLearning soft
- Page 191 and 192: Phalanger (compiler) 185 Phalanger
- Page 193 and 194: pHAML 187 pHAML Developer(s) David
- Page 195 and 196: pHAML 189 Hello World Hello W
- Page 197 and 198: Phoca Gallery 191 References [1] ht
- Page 199 and 200: PHP 193 PHP Paradigm imperative, ob
- Page 201 and 202: PHP 195 Licensing PHP is free softw
- Page 203 and 204: PHP 197 Security The National Vulne
- Page 205: PHP 199 $adder = getAdder(8); echo
- Page 209 and 210: PHP 203 [18] "GoPHP5" (http://gophp
- Page 211 and 212: HipHop for PHP 205 HipHop for PHP D
- Page 213 and 214: PHP-GTK 207 PHP-GTK Developer(s) An
- Page 215 and 216: PHP-GTK 209 External links • Offi
- Page 217 and 218: PHP-Nuke 211 • News—Manages new
- Page 219 and 220: Php4delphi 213 Php4delphi Appeared
- Page 221 and 222: phpDocumentor 215 phpDocumentor Sta
- Page 223 and 224: PhpGedView 217 PhpGedView can be ex
- Page 225 and 226: phpLDAPadmin 219 phpLDAPadmin Origi
- Page 227 and 228: phpMyAdmin 221 Release 0.9.0 Septem
- Page 229 and 230: phpMyAdmin 223 References [1] http:
- Page 231 and 232: phpPgAdmin 225 phpPgAdmin Stable re
- Page 233 and 234: PhpXCore 227 PhpXCore Stable releas
- Page 235 and 236: phpBB 229 Work on phpBB 3.0.x began
- Page 237 and 238: phpBB 231 phpBB3 phpBB3 is the curr
- Page 239 and 240: phpBB 233 The Development Team has
- Page 241 and 242: phpBB 235 phpBB Community phpBB is
- Page 243 and 244: phpBB 237 [45] phpBB (2009-07-29).
- Page 245 and 246: phplist 239 phplist Developer(s) Mi
- Page 247 and 248: phplist 241 Translations The admini
- Page 249 and 250: PHPmotion 243 Current status Versio
- Page 251 and 252: PhpWiki 245 See also • List of wi
- Page 253 and 254: Pimcore 247 Reviews and Articles
- Page 255 and 256: Piwigo 249 Main Features Categories
<strong>PHP</strong> 201<br />
Speed optimization<br />
<strong>PHP</strong> source code is compiled on-the-fly to an internal format that can be executed by the <strong>PHP</strong> engine. [68] [69] In<br />
order to speed up execution time and not have to compile the <strong>PHP</strong> source code every time the webpage is accessed,<br />
<strong>PHP</strong> scripts can also be deployed in executable format using a <strong>PHP</strong> compiler.<br />
Code optimizers aim to reduce the runtime of the compiled code by reducing its size and making other changes that<br />
can reduce the execution time with the goal of improving performance. The nature of the <strong>PHP</strong> compiler is such that<br />
there are often opportunities for code optimization, [70] and an example of a code optimizer is the eAccelerator <strong>PHP</strong><br />
extension. [71]<br />
Another approach for reducing overhead for high load <strong>PHP</strong> servers is using an opcode cache. Opcode caches work<br />
by caching the compiled form of a <strong>PHP</strong> script (opcodes) in shared memory to avoid the overhead of parsing and<br />
compiling the code every time the script runs. An opcode cache, APC, will be built into an upcoming release of<br />
<strong>PHP</strong>. [72] Opcode caching is also available in Zend Server Community Edition.<br />
Compilers<br />
The <strong>PHP</strong> language was originally implemented using a <strong>PHP</strong> interpreter. Several compilers now exist, which<br />
decouple the <strong>PHP</strong> language from the interpreter:<br />
• phc [73] - a C++ based compiler for <strong>PHP</strong>, using the Zend run-time for maximum compatibility<br />
• Roadsend - achieves native compilation by compiling to bigloo scheme, which in turn is compiled to C, then to<br />
machine code<br />
• Raven [74] - a rewrite of Roadsend <strong>PHP</strong> (rphp), based on LLVM and a new C++ runtime<br />
• Phalanger - compiles source code written in the <strong>PHP</strong> scripting language into CIL byte-code<br />
• Caucho Resin/Quercus [75] - compiles <strong>PHP</strong> to Java bytecode<br />
• HipHop - developed at Facebook and now available as open source, transforms the <strong>PHP</strong> Script into C++, then<br />
compiles it.<br />
• php-to-scala [76] - converts <strong>PHP</strong> to human-readable Scala source code, which the developer can compile to Java<br />
bytecode<br />
Advantages of compilation include not only better execution speed, but also obfuscation, static analysis, and<br />
improved interoperability with code written in other languages. [77]<br />
Resources<br />
<strong>PHP</strong> includes free and open source libraries with the core build. <strong>PHP</strong> is a fundamentally Internet-aware system with<br />
modules built in for accessing FTP servers, many database servers, embedded SQL libraries such as embedded<br />
PostgreSQL, MySQL and SQLite, LDAP servers, and others. Many functions familiar to C programmers such as<br />
those in the stdio family are available in the standard <strong>PHP</strong> build. [78]<br />
<strong>PHP</strong> allows developers to write extensions in C to add functionality to the <strong>PHP</strong> language. These can then be<br />
compiled into <strong>PHP</strong> or loaded dynamically at runtime. Extensions have been written to add support for the Windows<br />
API, process management on Unix-like operating systems, multibyte strings (Unicode), cURL, and several popular<br />
compression formats. Some more unusual features include integration with Internet Relay Chat, dynamic generation<br />
of images and Adobe Flash content, and even speech synthesis. The <strong>PHP</strong> Extension Community Library (PECL)<br />
project is a repository for extensions to the <strong>PHP</strong> language. [79]<br />
Zend provides a certification exam for programmers to become certified <strong>PHP</strong> developers.