1FALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE0FALSEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSEFALSE- 1FALSEFALSEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSEFALSElaquo;1raquo;FALSEFALSEFALSEFALSEFALSETRUEFALSEFALSEFALSEFALSEFALSElaquo;0raquo;FALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSEFALSEFALSElaquo;- 1raquo;FALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSEFALSENULLFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSEFALSEarray () FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUEFALSElaquo;phpraquo;FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSETRUE
PHP. , Foreach, Perl.
-, .. PHP.
Hello world PHP:
lt ;? php Hello, world! raquo ;;
? gt;
:
lt ;? = Laquo; Hello, world! raquo ;? gt;
lt ;? =. ,, Lt ;? php? gt ;. ,,. PHP- HTML-,,:
lt; html gt;
lt; head gt;
lt; title gt; PHP lt;/title gt;
lt;/head gt;
lt; body gt;
lt ;? php echo Hello, world! raquo ;;? gt;
lt;/body gt;
lt;/html gt;
lt ;? php? gt ;,, lt; ?? gt; lt; script language= php gt; lt;/script gt ;. , 6.0 ASP lt;%% gt; ( Lt; ?? gt; lt;%% gt; php. Ini).
$,. ,.. ,, Heredoc- (, lt; lt; lt;). , HTML. (;), If/else [11].
, ( amp;).:(/ * * /), C ++ (//) UNIX (#). ,,. (, PHP).
:
· (integer),
· (float, double),
· (boolean),
· (string),
· NULL.
:
· (resource),
· (array),
· (object),
:
· mixed lt; https: //ru.wikipedia/w/index.php? title=Mixed amp; action=edit amp; redlink=1 gt; ,
· number (integer float),
· callback (string),
· void.
(integer) PHP (, 32-,,? 2147483648 2147483647). ,. (double) (32 ± 1.710? 308 ± 1.710 + 308). (boolean), TRUE ( ) FALSE ( ). 0,, 0 raquo ;, NULL FALSE. TRUE.
NULL. NULL. NULL, NULL,, unset ().
(resource). ,,,,,, ..
(array). ,.. php-,,,. for foreach. ,,,.
PHP callback. 5.3,,:
($ args. $ argsN) use ($ ctxVar, $ ctxVar1) {definition; }
:
· ();
· - ();
· -, - ().
is_callable ($ var)
$,..:
$ a= I am a raquo ;;// $ A $ a;// $
$ b= a raquo ;; $$ b;// $ ($ $ B) $ { a };// $ A_name ();// Function_name
$ c= function_name raquo ;;
$ c ();// Function_name,
$ d= Class_name raquo ;;
$ obj=new Class_name;// Class_name
$ obj=new $ d ();// Class_name
$ obj- gt; b;// B
$ obj- gt; c ();// C ()
$ obj- gt; $ b;// A, $ b= a
$ obj- gt; $ c ();// Function_name (), $ c= function_name
PHP echo print (print),..
(. Superglobal arrays) PHP, global. (GET-, POST, ..).
, $ GLOBALS $ _REQUEST,, 5.3 (5.4.0). , $ _GET [ Laquo; year ] $ HTTP_GET_VARS [ year ] (: ) [12].
$ 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. , Laquo; name ,,,:
· [ name ] -.
· [ type ] - MIME-. PHP,,.
· [ size ] -.
· [ tmp_name ] -. move_uploaded_file. PHP.
· [ error ] -. , 0 (UPLOAD_ERR_OK).
$ _ COOKIE (. $ HTTP_COOKIE_VARS)
.
$ ...