GNU Free Documentation License . .

PHP

: ,
PHP
PHP-logo.svg
:

:

[1][2]

:

1994

():

:

5.4.3[3] (8 2012)

:

:

Perl, C, C++, Java

:

www.php.net

PHP (. PHP: Hypertext Preprocessor  «PHP: »; Personal Home Page Tools[4]  « -»)  [5] , -. - , -.[6]

.[7] , GNU GPL.

[]

PHP  ( JSP, Perl , ASP.NET) , , , PHP.

- -[8]. :

PHP . TIOBE, , 2011 PHP 5 .[6] , PHP, Facebook, , Wikipedia .

LAMP  - (Linux, Apache, MySQL, PHP).

[] GUI-

PHP , GUI-.

PHP-GTK PHP-Qt, .

WinBinder

, Windows API . - open source WinBinder[9]. C php  php_winbinder.dll. WinBinder , (. ) WinBinder. , , WinBinder WinAPI   .

DevelStudio

Devel Studio[10], , , .[11]

PHP .NET/Mono Phalanger. PHP Phalanger .NET-, .

[]

1994 Perl/CGI -, HTML-. Personal Home Page ( ). Perl    , C PHP/FI (. Personal Home Page / Forms Interpreter  « / »).

1997 - , C  PHP/FI 2.0. Ÿ 1 % ( 50 ) - .[4]

PHP 3.0 , . 1997 , , . PHP 3.0 1998 .[4]

PHP 3.0 . PHP , , PHP , , API. . php «PHP: hypertext Preprocessor», «Personal Home Page».

1998 , PHP 3.0, PHP. PHP. , Zend Engine, 1999 . PHP 4.0, , 2000 . , PHP 4.0 , , , .

PHP 13 2004 . Zend (Zend Engine 2), . XML. , , Java. , , , , , . , , , PHP 5.0.

PHP [12] 2006 . [13][14] , , , POSIX «» , safe_mode, magic_quotes_gpc register_globals php.ini. .[15]. 2010 PHP6 [16] - . PHP6 , 5.4.

[]

PHP . , foreach, Perl.

- ,  . . PHP.

Hello world PHP :

<?php
  echo 'Hello, world!'; 
?>

PHP , , <?php ?>. , , . PHP- HTML-, , :

<html>
 <head>
  <title> PHP</title>
 </head>
 <body>
  <?php echo 'Hello, world!'; ?>
 </body>
</html>

<?php ?>, , <? ?> <script language="php"> </script>. , 6.0 ASP <% %> ( <? ?> <% %> php.ini).

$, . , . . , , heredoc- (, <<<).

PHP , HTML . (;), , if/else .

PHP : ( /* */), C++ ( // ) UNIX ( # ).

[]

PHP , , . (, PHP ).

:

  • (integer),
  • (float, double),
  • (boolean),
  • (string),
  • NULL.

:

  • «» (resource),
  • (array),
  • (object),

[17] :

(integer) PHP (, 32- , , 2 147 483 648 2 147 483 647). , . (double), , ( 32- ±1.7×10308 ±1.7×10+308).

PHP (boolean), TRUE («») FALSE («»). 0, , «0», NULL FALSE. TRUE.

NULL . NULL. NULL , NULL, , unset().

«» (resource). , , , , , ,  . .

(array) . , . . php- , , , . for foreach. , , , .

PHP callback. 5.3 , , :

 function($args..$argsN) use($ctxVar,$ctxVar1) { definition ; }

callback :

  • ( );
  • - ( );
  • - , - ( ).

is_callable($var)

[]

$, . .[18] :

$a = 'I am a';        //     $a
echo $a;              //   $
 
$b = 'a';
echo $$b;             //   $ ( $   $b)
 
echo ${'a'};      //   $a
 
function_name();      //   function_name
$c = 'function_name';
$c();                 //   function_name,
 
$d = 'Class_name';
$obj = new Class_name; //    Class_name
$obj = new $d();      //    Class_name
 
$obj->b;     //    b 
$obj->c();   //   c() 
 
$obj->$b;    //    a ,   $b = 'a'
$obj->$c();  //   function_name() ,   $c = 'function_name'

PHP echo print [19] ( print ), . .

[]

(. Superglobal arrays) PHP , global. ( GET-, POST,  . .).

, $GLOBALS $_REQUEST, , PHP ( ). , $_GET['year'] $HTTP_GET_VARS['year'] ( : «» ).

$GLOBALS
( ).
$_SERVER (   $HTTP_SERVER_VARS)
, .
$_ENV (. $HTTP_ENV_VARS)
(. Environment variables). , .
$_GET (. $HTTP_GET_VARS)
GET-, URI «?».
$_POST (. $HTTP_POST_VARS)
HTML- POST. name HTML-.
$_FILES (. $HTTP_POST_FILES)
POST . , «name» , , , :
  • ['name']  .
  • ['type']  MIME- . PHP , , .
  • ['size']  .
  • ['tmp_name']  . move_uploaded_file. PHP .
  • ['error']  . , 0 (UPLOAD_ERR_OK).
$_COOKIE (. $HTTP_COOKIE_VARS)
.
$_REQUEST
$_GET, $_POST, $_COOKIE. PHP 4.1 $_FILES.
$_SESSION (. $HTTP_SESSION_VARS)
.

[] -

PHP - , .

PHP class. (public, ), (protected) (private). PHP   , ( extends ). ( implements). , . , . parent.

PHP (. Magic methods), . (__construct(), 5.0 , ) (__destruct()), (__get()) (__set()), (__sleep()) (__wake()), (__clone()) . : , .

new, ->. $this.

class C1 extends C2 implements I1, I2
{
  private $a;
  protected $b;
 
  function __construct($a, $b)
  {
    parent::__construct($a, $b);
    $this->a = $a;
    $this->b = $b;
  }
 
  public function plus()
  {
    return $this->a + $this->b;
  }
/* ...............  */
}
 
$d = new C1(1, 2);
echo $d->plus(); // 3

PHP, :

class a 
{
  public $color = 'red';
}
 
$a = new a();
echo $a -> color; // red
$b = $a;
$b -> color = 'blue';
echo $a -> color; // blue

«Paamayim Nekudotayim» « ». , , . , . «Paamayim Nekudotayim» . , Zend Engine 0.5 ( PHP3), Andi Zeev [20] . «Paamayim Nekudotayim» « » . PHP.[21]

<?php
class MyClass {
  const CONST_VALUE = ' ';
}
//  ::   
echo MyClass::CONST_VALUE;
?>

[]

PHP- [1], :

  1. ,
  2. ,
  3. -,
  4. - ( ).

,   . - / , , 13, .

, . PHP ; .[22]

[]

, «», . , , , , , PDF   . . , , , . PECL.

[]

PHP   php.ini, , .[23] , , , , , , , . ini_set.[24]

[]

PHP:

  1. - SAPI ISAPI[25] (, Apache mod_php). - php- -. PHP :
  2. CGI. , - /usr/bin/php-cgi /path/to/script.php. php-cgi, , , -. FastCGI. , PHP [28][29], , PHP .
  3. , , ; . PHP GUI-[30] UNIX, Linux, Microsoft Windows, Mac OS X AmigaOS. , , Perl, Python VBScript

[]

PHP (). GET- php- .

:

_.php?=PHPE9568F36-D428-11d2-A769-00AA001ACF42

, :

  1. Thies Arntzen ( 4.1.2, 4.2.2)
  2. ( Stig Bakken) ( 4.3.2, 4.3.3, 4.3.8  4.3.10)
  3. ( Zeev Suraski) ( 4.3.11, 4.4.0  4.4.4, 5.1.0, 5.1.2)
  4. ( 4.3.1, 5.0.0, 5.0.3)
  5. PHP ( 5.1.3 5.2.13)[31]
  6. PHP ( 5.3.0)[31]

PHP ZEND, :[31]

_.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42
_.php?=PHPE9568F35-D428-11d2-A769-00AA001ACF42

PHP- php_logo_guid zend_logo_guid Zend.

PHP (4,5):[31]

_.php?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000

[]

PHP -, , PHP . 2010  Facebook [32][33] PHP  HipHop (HPHP, Hyper-PHP) C++, gcc.

.

HipHop PHP License C++,
Roadsend PHP GPL/LGPL C,
Phalanger Ms SS-PL[34] (Shared source) Microsoft IL
Quercus ( - Resin) GPL JVM
PHC BSDL C,
Pipp[35] Artistic License GNU GPL Parrot

phpclasses.org : PHP compiler performance.

[]

[] PHP

[] PEAR

[] -

PHP , , .

[]

PHP , Zend Framework, CakePHP, Symfony, CodeIgniter, Kohana Yii[36].

[] PHP

Komodo Mozilla tri-license (MPL/LGPL/GPL)[37] http://www.activestate.com
JetBrains PhpStorm Trial http://www.jetbrains.com/phpstorm/
PHP Development Tools Eclipse Public License http://www.eclipse.org/pdt/
Zend Studio Shareware http://www.zend.com/products/zend_studio/
Aptana Studio GNU GPL http://www.aptana.org
phpDesigner Shareware http://www.mpsoftware.eu/
PHP Expert Editor Shareware[38] http://www.phpexperteditor.com/
NetBeans IDE CDDL http://www.netbeans.org/
RadPHP XE Trial http://www.embarcadero.com/products/radphp/
NuSphere Trial http://www.nusphere.com/
KDevelop[39] GNU GPL http://www.kdevelop.org/
Microsoft WebMatrix Freeware http://www.microsoft.com/web/webmatrix/
Notepad++ GNU GPL http://notepad-plus-plus.org/

[]

[]

PHP , , . , , array_, . str, . , , , , , . , , , .

PHP . , PHP , Perl. , , .

[]

, , [40]. , , , . , , , . : , .

5.3.x , [41], , . 5.3 Zend Optimizer. 2010 [42]

,   . ( ), . , Python  3.x, Perl 6, , , perl- . , , . PHP 5.3.

[]

, UTF-8 mbstring iconv, , PHP 4.2.0 , mbstring.

[]

, PCNTL[43].

[]

[44]:

  • PHP 20-45 ; PHP 30 78 % ;
  • 95 % PHP  ;
  • 80 % PHP ;   17 %;
  • 60 % PHP , 26 %  , 8 %  ;

[]

  1. 1 2 PHP Compiler Internals  (.). 21 2011. 17 2009.
  2. PHP: Zend API: Hacking the Core of PHP  Manual
  3. PHP 5.4.3 Release notes
  4. 1 2 3 PHP: History of PHP  Manual
  5. PHP: Preface  Manual  (.). 21 2011.
  6. 1 2 TIOBE Software: Tiobe Index
  7. History of PHP and related projects  (.). 21 2011.
  8. PHP:   Manual  (.) (21 2009). 21 2011. 13 2009.
  9. WinBinder home page
  10. Devel Studio
  11. Visual PHP Windows, DevelStudio
  12. news.txt PHP 6
  13. PHP 6
  14. , 2005
  15. PHP6
  16. PHP: Pseudo-types and variables used in this documentation - Manual
  17. PHP: Variable variables  Manual
  18. PHP: echo  Manual
  19. , C++, , , , .
  20. http://php.net/manual/en
  21. PHP: Basic memory management  Manual  (.) (13 2009). 21 2011. 17 2009.
  22. PHP: php.ini directives  Manual  (.) (6 2009). 21 2011. 13 2009.
  23. PHP: List of php.ini directives  Manual  (.) (6 2009). 21 2011. 13 2009.
  24. PHP: Installed as an Apache module  Manual
  25. 1-  mod_php vs CGI vs FastCGI
  26. PHP: HTTP- PHP  Manual (21 2009). 21 2011. 13 2009.
  27. PHP | FastCGI
  28. PHP- 22 , FastCGI PHP
  29. PHP: PHP   Manual  (.) (21 2009). 21 2011. 13 2009.
  30. 1 2 3 4 PHP Easter Egg  (.). 21 2011. 16 2009.
  31. HipHop for PHP: Move Fast
  32. Facebook PHP
  33.  (.)
  34. Merkel Dirk Chapter 6: PHP Frameworks // Expert PHP 5 Tools.  Packt Publishing, 2010.  ISBN 978-1-847198-38-9
  35. Komodo IDE is a Professional Development Environment for Perl, Python, Tcl | ActiveState
  36. exUSSR
  37. PHP support for KDevelop 4 (and eventually Quanta+) | Milian Wolff
  38. PHP: Backward Incompatible Changes  Manual
  39. PHP: Deprecated features in PHP 5.3.x. php.net Team. 21 2011.
  40. We plan to release a zend guard and runtime for php 5.3 later this year.. Zend Forums. 21 2011.
  41. PCNTL
  42. SuperJob.ru « PHP» 9 . Superjob.ru ( 2009 ).

[] .

[]

[]