Вы находитесь на странице: 1из 24

PHP

User Server Index.html


?

Apache
MySQL
PHPmodule

XAMPP
LAMPP
AppServ
OpenServer
MAMP
php

User Server Index.php

Server PHP module



<div>text</div>
<?php
if ( $User->isAuth() ) {
echo hello.$User->Name;
}
?>

<?php ?> - classic php tag


<? . ?> - short open tag
<% %> - asp style tag

<?php
//
/* */
$name = value;
echo $name;
print $name;
var_dump($name);
print_r($name);
phpinfo();
?>
!!!!
echo

, ,
, echo

<?=$variable?>

define( , [,=false])
undef( )
defined( ) or die( )

php 5.3+:
const NAME=value;

<?php
error_reporting(0);
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
error_reporting(E_ALL);
error_reporting(E_ALL & ~E_NOTICE);
ini_set('error_reporting', E_ALL);
?>

boolean, integer, float, string

array, object
C
resource, NULL

+ - / = * % ++ --
.
> < >= <= == === != !==
! && || and or xor
>> << & | ~ ^



024
11
11.1
15
02
PHP

== (!=)
=== (!==)

3.00000000000000000007==3.00000000000000000001

Var = condition ? Value1 : Value2;


If($a==$b){ If($a==$b):
. .
} elseif( $a==$c ){ elseif( $a==$c ):
.. ..
} else { else :

} endif;

switch($a){ switch($a):
case 1: case 1:
. .
break; break;
default: default:
. .
break; break;
} endswitch;


switch case
.

while(condition){
while(condition):
.
.
}
endwhile;

do{
.
} while(condition);
for

for( init, condition,past action){


.
}
for( init, condition,past action):
.
endfor;

unset() @ -

isset()
empty() $a = @$b;

is_null()
$b = (bool) $a
is_boolean()
settype($var, int) $b = (int) $a
is_integer()
gettype($var) $b = (double) $a
is_string()
$b = (string) $a
is_array()

setlocale(LC_ALL, ru_RU)

LC_ALL -
LC_COLLATE -
LC_CTYPE -
LC_TIME -
LC_MASSAGES -
1. -
2.

include path_to_file
require path_to_file
include_once path_to_file
require_once path_to_file

Вам также может понравиться