php
!
PHP.
.
PHP,
, ,
,
PHP-. ,
, .
,
, PHP
- ,
, , ..
PHP?
PHP ( : PHP: Hypertext
Preprocessor) - ,
web-. ,
Java Perl, ,
. PHP
server-side HTML-embedded scripting language (
HTML ).
:
- PHP ,
, , JavaScript
- PHP
HTML , Perl.
PHP ,
PHP, PHP .
<html>
<head>
<title>Example</title>
</head>
<body>
<?php echo "Hi, I'm a PHP script!"; ?>
</body>
</html>
PHP
HTML : ,
PHP (<?php ?>
) PHP
PHP.
PHP Rasmus Lerdorf,
,
. (
PHP 1994 )
,
(, ..), .
PHP
4- , PHP
Zend scripting engine,
Zend technologies.
,
, . ,
, Zend scripting
engine , ..
PHP , ,
PHP .
PHP 4. ,
PHP 4.0.6
PHP ?
PHP -
: https://www.php.net/.
php ( ),
..
,
:-)
, -
, PHP :-)
, PHP Manual,
PHP - ,
- . ,
PHP.
, .
, PHP - PHP Builder.
: , ..
, -
PHP ... :-)
(
),
PHP, :
, PHP.
PHP .
.
downloads
( PHP
),
Unix,
Windows.
, , , , ..
PHP ( )
. Windows
,
PHP,
. www.php4win.de.
, , ..
PHP ,
..
.
, PHP
, , ,
..
. , ""
PHP ? -
.. "" PHP.
PHP. ,
( )
,
, , .
-. ,
: snaps.php.net
PHP
- PHP
C, Java Perl.
, -
PHP.
php. .
-
PHP Manual.
, PHP .
PHP ,
$, $variable. ,
C/C++-
,
.
-
.
,
- , , PHP
.
-
, . ,
, :
$name = 'value';
$value = 5;
echo $$name;
PHP 5.
- PHP :
"anything is an expression" ( ).
PHP
$$name
:
- $, ,
- $,
,
.
- name,
, ('value') .
- ,
.
(value) (5).
,
!
, , ..
,
( PHP
).
php
PHP
!
:
$name = 'John';
$age = 23;
echo "$name is $age years old";
: John is 23 years
old. , ?
- PHP,
, ,
.
, !
, .
,
.
:
$man = array('John',23);
echo "{$man[0]} is {$man[1]} years old";
, .
PHP
.. here docs. :
$str = <<<TEXT
There can be any text
which will be stored
into a string
right in the same way
as it
typed here
TEXT;
,
(
TEXT,
). , here doc,
<<< .
,
- , ,
. , here docs
.
PHP - .
,
. ,
,
. ,
. PHP
,
.
, PHP
: PHP
!
, .
-
.
, . PHP
:
$data = array(1,10,100,1000, //
'Some text','Another text', //
'name'=>'John','age'=>23, //
'date'=>array('day'=>10,'month'=>'may','year'=>2001)); //
-
- ! ,
:
echo $data[1]; // - 10
echo $data[5]; // - 'Another text'
echo $data['age']; // - 23
echo $data['date']['month']; // - 'may'
Variable scope
,
" ",
:-)
, ,
,
- ,
,
.
PHP . ""
, PHP
, ,
! ,
, PHP
. "" ,
, , ..
" ",
,
.
? 2
:
- $GLOBALS.
PHP,
"" ,
. ..
$variable - ,
$GLOBALS['variable'] - .
function myFunction() {
$variable = 5; //
$GLOBALS['variable'] = 10; //
};
- global.
,
:
function myFunction() {
global $variable;
$variable = 10; //
};
?
. PHP
,
.
, .
, ?
-
-
-
-
- , upload ..
- Regular expressions
-
- XML/XSLT
- - ? !
,
,
. -,
- , ,
!