php geo book

69
2007 PHP ვიკიწიგნების ბიბლიოთეკიდან ღონღაძე გიორგი|Gnome 2007 წიგნით, თავიდან ბოლომდე შეისწავლით PHP- ს საწყისებს. წიგნი განკუთვნილია დამწყებთათვის

Upload: gakba

Post on 25-Nov-2015

53 views

Category:

Documents


0 download

DESCRIPTION

PHP learn in georgian

TRANSCRIPT

  • 2007

    PHP

    |Gnome

    2007 , PHP- .

  • I

    PHP

    PHP

    ?

    php- , :

    HTML / XHTML

    HTML- : http://ka.wikibooks.org/wiki/HTML

    PHP?

    PHP , , Hypertext Preprocessor( )

    PHP , ASP

    PHP

    PHP (MySQL, Informix, Oracle, Sybase, Solid,

    PostgreSQL, Generic ODBC ..) PHP (OSS) PHP -

    PHP ?

    PHP , HTML

    PHP , HTML

    PHP : ".php", ".php3", ".php4", ".php5", ".phtml"

    MYSQL?

    MySQL

    MySQL

    MySQL SQL- MySQL

    MySQL-

    PHP + MYSQL

  • PHP MySQL - ( , Windows- Unix )

    PHP?

    PHP (Windows, Linux, Unix ..)

    PHP , - (Apache, IIS ..)

    PHP

    ?

    Apache server, Windows-, Linux -

    PHP , Windows-, Linux - MySQL , Windows-, Linux -

    PHP INSTALL

    ?

    , , PHP, MySQL, Apache Server.

    PHP - , ! , .php . PHP-.

    , PHP-, PHP. PHP- :

    http://www.php.net/manual/en/install.php

    PHP

    PHP: http://www.php.net/downloads.php

    MYSQL

    MySQL : http://www.mysql.com/downloads/index.html

    APACHE

    Apache : http://httpd.apache.org/download.cgi

    PHP

  • PHP

    PHP : . PHP .

    , , : .

    , :

    PHP HTML , , HTML PHP

    .

    PHP , "Hello World" :

    PHP- -. - , .

    PHP- : echo print. echo.

    PHP-

    PHP-, // -, , /* */

    .

    PHP

  • PHP-

    , ,

    , .

    , .

    PHP- : $.

    PHP- :

    $var_name = value;

    :

    PHP

    PHP-

    , , PHP- .

    PHP .

    , : _

    (a-Z, 0-9, _ )

    .

    , ($my_string), ($myString)

    PHP

    PHP-

    , .

    .

    , .

    , PHP "Hello World" $txt :

  • $txt="Hello World";

    echo $txt;

    ?>

    :

    Hello World

    .

    (.) .

    :

    :

    Hello World 1234

    ,

    . . .

    STRLEN()

    strlen() .

    "Hello world!" :

    :

    12

    STRPOS()

    strpos() , .

    , . , : FALSE.

  • :

    : 6

    "world" .

    , 0- 1-.

    PHP

    + X=2; x+2 4

    - X=2; 5-x 3

    * X=4; x*5 20

    / 15/5 3

    % 5%2 1

    ++ X=5; x++ X=6

    -- X=5; x-- X=4

    ...,

    = X=y x=y

    += X+=y x=x+y

    -= x-=y x=x-y

    *= X*=y x=x*y

    /= X/=y x=x/y

    %= X%=y x=x%y

    == 5==8, False

    != 5!=8, True

    > 5>8, False

    < 5= , 5>=8, False

  • && And x=6 y=3

    (x < 10 && y > 1) true

    || Or x=6 y=3

    (x==5 || y==5) false

    ! Not x=6 y=3 !(x==y) true

    PHP IF. ..ELSE

    , ,

    .

    .

    if...else - ,

    , .

    elseif - if...else- , .

    IF...ELSE

    :

    if (condition)

    code to be executed if condition is true;

    else

    code to be executed if condition is false;

    :

    "Have a nice weekend!" , "Have a nice day!":

  • ELSEIF

    :

    if (condition)

    code to be executed if condition is true;

    elseif (condition)

    code to be executed if condition is true;

    else

    code to be executed if condition is false;

    :

    "Have a nice weekend, Friday, "Have a nice Sunday!", . "Have a nice day!":

    PHP SWITCH

    , Switch .

    switch if..elseif..else .

    :

    switch (expression)

    {

    case label1:

    code to be executed if expression = label1;

    break;

    case label2:

  • code to be executed if expression = label2;

    break;

    default:

    code to be executed

    if expression is different

    from both label1 and label2;

    }

    :

    :

    .

    .

    , .

    , break

    .

    (default) .

    PHP

    ?

    PHP-, , .

    , .

    ID, .

    :

  • Numeric array( ) - ID Associative array( ) - , ID

    .

    Multidimensional array( ) - .

    .

    1:

    , ID :

    $names = array("Peter","Quagmire","Joe");

    2:

    , ID :

    $names[0] = "Peter";

    $names[1] = "Quagmire";

    $names[2] = "Joe";

    ID :

  • ,

    :

    $ages['Peter'] = "32";

    $ages['Quagmire'] = "30";

    $ages['Joe'] = "34";

    ID :

    :

    Peter is 32 years old.

    :

    , ID

    :

    $families = array

    (

    "Griffin"=>array

    (

    "Peter",

    "Lois",

    "Megan"

    ),

    "Quagmire"=>array

    (

    "Glenn"

    ),

    "Brown"=>array

    (

    "Cleveland",

    "Loretta",

    "Junior"

    )

    );

    , :

    Array

    (

    [Griffin] => Array

    (

    [0] => Peter

    [1] => Lois

    [2] => Megan

    )

    [Quagmire] => Array

  • (

    [0] => Glenn

    )

    [Brown] => Array

    (

    [0] => Cleveland

    [1] => Loretta

    [2] => Junior

    )

    )

    2:

    :

    echo "Is " . $families['Griffin'][2] .

    " a part of the Griffin family?";

    :

    Is Megan a part of the Griffin family?

    PHP

    , , . .

    PHP- :

    while -

    do...while -

    for - n- foreach -

    WHILE

    while (condition)

    code to be executed;

    , i , 5-. i 1-:

  • DOWHILE

    do

    {

    code to be executed;

    }

    while (condition);

    i- i- 5:

    FOR

    for (initialization; condition; increment)

    {

    code to be executed;

    }

    : For . ,

    .

    , , .

    True, False.

  • "Hello World!"- :

    FOREAC H

    , $value -

    , .

    foreach (array as value)

    {

    code to be executed;

    }

    PHP

    PHP

    , .

    PHP :

    "function()"

    - .

    .

    "{" - .

  • "}" -

    PHP

  • :

    My name is Kai Jim Refsnes.

    My name is Hege Refsnes.

    My name is Stale Refsnes.

    2

    :

    :

    My name is Kai Jim Refsnes.

    My name is Hege Refsnes!

    My name is Stle Refsnes...

    PHP -

  • :

    1 + 16 = 17

    PHP

    PHP

    :

    Name:

    Age:

    HTML .

    , "welcome.php" .

    "welcome.php" :

    Welcome .

    You are years old.

    :

    Welcome John.

    You are 28 years old.

    PHP $_GET

  • THE $_GET

    $_GET HTTP GET

    .

    $_GET method="get"- . , GET (

    ) (. 100

    ).

    Name:

    Age:

    , URL :

    http://geocg.myweb.ge/welcome.php?name=Peter&age=37

    "welcome.php" $_GET

    :

    Welcome .

    You are years old!

    $_REQUES T

    PHP $_REQUEST : $_GET, $_POST, $_COOKIE.

    PHP $_REQUEST , GET POST .

    :

    Welcome .

    You are years old!

    PHP $_POST

    $_POST

    $_POST HTTP POST .

  • $_POST method="post"- . , POST .

    Enter your name:

    Enter your age:

    , URL :

    http://geocg.myweb.ge/welcome.php

    "welcome.php" $_POST

    :

    Welcome .

    You are years old!

  • II

    PHP

    PHP

    PHP DATE()

    :

    date(format,timestamp)

    .

    . .

    PHP - ?

    , January 1, 1970 at 00:00:00 GMT. Unix .

    PHP -

    date() /

    . / .

    , :

    d - / (01-31)

    m - (01-12)

    Y -

    , "/", ".", "-"

    :

    :

  • 2007/07/11

    2007.07.11

    2007-07-11

    PHP -

    date() .

    . ,

    .

    , mktime() .

    mktime() Unix .

    :

    mktime(hour,minute,second,month,day,year,is_dst)

    mktime():

    :

    Tomorrow is 2006/07/12

    PHP -

    PHP ,

    include(), require() . , . include()

    ( ) , require() ( ).

    , , ,

    ,

    .

    .

    , .

    , ,

    , .

  • INCLUDE()

    include()

    .

    1:

    , "header.php".

    , include() :

    Welcome to my home page

    Some text

    2:

    .

    :

    Home |

    About Us |

    Contact Us

    , "index.php", "about.php", "contact.php" "menu.php" .

    :

    Welcome to my home page

    Some text

    :

    Home |

    About Us |

    Contact Us

    Welcome to my home page

    Some text

    REQUIRE( )

  • include() ,

    .

    PHP :

    :

    Warning: include(wrongFile.php) [function.include]:

    failed to open stream:

    No such file or directory in C:\home\website\test.php on line 5

    Warning: include() [function.include]:

    Failed opening 'wrongFile.php' for inclusion

    (include_path='.;C:\php5\pear')

    in C:\home\website\test.php on line 5

    Hello World!

    echo !

    .

    require() .

    PHP :

    :

    Warning: require(wrongFile.php) [function.require]:

    failed to open stream:

    No such file or directory in C:\home\website\test.php on line 5

    Fatal error: require() [function.require]:

    Failed opening required 'wrongFile.php'

    (include_path='.;C:\php5\pear')

    in C:\home\website\test.php on line 5

    echo .

    require() .

    PHP -

  • fopen() PHP- .

    ,

    , :

    - :

    r .

    r+ /.

    w . ;

    w+ /. ;

    a . , ,

    a+ /.

    x . . FALSE ,

    x+ /. . FALSE ,

    : fopen() , 0-.

    , fopen() :

  • fclose() :

    END-OF-FILE-

    feof() , ("end-of-file" (EOF)) .

    feof() .

    : , w, a, x !

    if (feof($file)) echo "End of file";

    -

    fgets() .

    : .

    - , , :

    -

    Fgetc() - .

    : .

    - , , :

  • PHP -

    HTML :

    Filename:

    HTML :

    enctype ,

    .

    "multipart/form-data" , , .

    : .

    "upload_file.php" :

  • PHP $_FILES

    .

    input , "name", "type", "size", "tmp_name", "error". :

    $_FILES["file"]["name"] -

    $_FILES["file"]["type"] -

    $_FILES["file"]["size"] -

    $_FILES["file"]["tmp_name"] - $_FILES["file"]["error"] -

    . ,

    .

    .

    .gif, . jpeg 20 kb-:

    : IE- jpg pjpeg, FireFox- jpeg.

    , .

    , . :

  • PHP COOKIES()

    (COOKIE)?

    .

    , .

    , .

    PHP-, .

    ?

    setcookie() .

    : setcookie() .

    :

    setcookie(name, value, expire, path, domain);

    :

    "user"

    "Alex Porter":

  • ?

    PHP $_COOKIE .

    , "user"

    :

    isset() , :

    ?

    :

    , ,

    .

    "welcome.php"- "Submit" :

  • Name:

    Age:

    "welcome.php"- :

    Welcome .

    You are years old.

    PHP

    PHP

    , ,

    . . . . : .

    PHP . ,

    .

    (UID) UID-.

    PHP

    PHP , .

    : session_start() :

    ,

    UID .

  • PHP $_SESSION

    :

    :

    Pageviews=1

    , . isset()

    "views" . "views" ,

    . "views" ,

    "views" 1-:

    , unset(), session_destroy()

    .

    unset() :

    session_destroy()

    :

    : session_destroy() .

  • PHP .

    PHP MAIL()

    PHP mail() . .

    mail(to,subject,message,headers,parameters)

    to . . /

    subject . .

    : .

    message . . LF (\n)-.

    headers . , From, Cc Bcc.

    CRLF (\r\n)-

    parameters .

    PHP .

    PHP- . .

    ($to, $subject, $message, $from, $headers), mail() :

    PHP

    PHP- -. :

  • {

    echo "

    Email:

    Subject:

    Message:

    ";

    }

    ?>

    ,

    .

    ?

    [email protected]%0ACc:[email protected]

    %0ABcc:[email protected],[email protected],

    [email protected],[email protected]

    %0ABTo:[email protected]

    mail()

    Cc:, Bcc: To: . Submit , .

    PHP .

    .

    , , :

  • }

    else

    {

    //send email

    $email = $_REQUEST['email'] ;

    $subject = $_REQUEST['subject'] ;

    $message = $_REQUEST['message'] ;

    mail("[email protected]", "Subject: $subject",

    $message, "From: $email" );

    echo "Thank you for using our mail form";

    }

    }

    else

    //if "email" is not filled out, display the form

    {

    echo "

    Email:

    Subject:

    Message:

    ";

    }

    ?>

    PHP -

    PHP

    ,

    . ,

    .

    :

    "die()"

    : DIE()

    , :

    :

    Warning: fopen(welcome.txt) [function.fopen]: failed to open stream:

    No such file or directory in C:\webfolder\test.php on line 2

  • , ,

    , :

    , :

    File not found

    ,

    .

    , . PHP .

    .

    , PHP- .

    :

    error_function(error_level,error_message,

    error_file,error_line,error_context)

    error_level . .

    error_message .

    error_file . ,

    error_line . ,

    error_context . ,

  • :

    2 E_WARNING - .

    8 E_NOTICE - . ,

    256 E_USER_ERROR .

    PHP trigger_error()-

    E_ERROR-

    512 E_USER_WARNING .

    PHP trigger_error()-

    E_WARNING-

    1024 E_USER_NOTICE .

    PHP trigger_error()-

    E_NOTICE -

    4096 E_RECOVERABLE_ERROR . E_ERROR-,

    8191 E_ALL , E_STRICT -

    :

    function customError($errno, $errstr)

    {

    echo "Error: [$errno] $errstr";

    echo "Ending Script";

    die();

    }

    .

    , . .

    , , .

    PHP- .

    .

    ,

    . ,

  • . , :

    set_error_handler("customError");

    , ,

    set_error_handler()- , .

    :

    , , :

    :

    Custom error: [8] Undefined variable: test

    ,

    , . PHP- trigger_error() .

    :

    , "test" , "1":

    :

    Notice: Value must be 1 or below

    in C:\webfolder\test.php on line 6

    ,

    , .

  • :

    E_USER_ERROR - - .

    .

    E_USER_WARNING - - . .

    E_USER_NOTICE - . - . , .

    :

    E_USER_WARNING . , "test" , "1". E_USER_WARNING

    :

    :

    Error: [512] Value must be 1 or below

    Ending Script

    ,

    .

    , PHP ,

    , error_log php.ini

    . error_log() , .

    - .

    -

  • ,

    :

    :

    Error: [512] Value must be 1 or below

    Webmaster has been notified

    - :

    Error: [512] Value must be 1 or below

    . , PHP

    .

    PHP

    ?

    PHP 5- .

    ,

    . .

    :

    .

    , , , .

    :

  • -

    : .

    , PHP "" .

    , "Uncaught Exception"

    .

    :

    :

    Fatal error: Uncaught exception 'Exception'

    with message 'Value must be 1 or below' in C:\webfolder\test.php:6

    Stack trace: #0 C:\webfolder\test.php(12):

    checkNum(28) #1 {main} thrown in C:\webfolder\test.php on line 6

    ,

    , .

    :

    1. - , "try" .

    , . ,

    , "". 2. - , . ""

    "".

  • 3. - "" , .

    :

    :

    Message: Value must be 1 or below

    :

    :

    1. checkNum() . , , 1-. , .

    2. checkNum() "try"

    3. checkNum()

    4. "catch" ($e) ,

    5. $e->getMessage()- .

    , " "

    . - , .

    .

    , ,

  • PHP- . .

    PHP-

    .

    :

    errorMessage() .

    , - getLine() getFile() getMessage().

    :

    :

    1. customException() ,

    .

    2. errorMessage() . ,

    - 3. "try" , -

    4. "catch"

  • ,

    .

    if..else , , . :

    :

    ,

    :

    1. customException() .

    2. errorMessage() . ,

    -

    3. "try"

    4. , - "example"

  • 5. "catch"

    , , .

    , ,

    . "catch" .

    .

    , . :

    :

    - , "example", , :

    1. customException()

  • 2. errorMessage() . ,

    - 3. "try" "try" ,

    4. , "example"

    5. "catch" "customException" 6. "customException"

    "try" ,

    " " .

    -

    :

    Exception: Uncaught Exception occurred

    "catch" .

    .

    ,

    , ""

    ()

    : , .

    PHP

    PHP ?

    PHP

    .

    ?

  • .

    , . , .

    !

    ?

    , - :

    filter_var() - ,

    filter_var_array() - , ,

    filter_input -

    filter_input_array - ,

    , filter_var() :

    "FILTER_VALIDATE_INT" . : "Integer is valid".

    , ( "123abc"), : "Integer is not valid".

    :

    :

  • :

    .

    .

    , filter_var(), "min_range" "max_range" :

    ,

    options . .

    "300"-, : "Integer is not valid".

    , .

    filter_input() .

    , "email PHP :

  • else

    {

    if (!filter_input(INPUT_GET, "email", FILTER_VALIDATE_EMAIL))

    {

    echo "E-Mail is not valid";

    }

    else

    {

    echo "E-Mail is valid";

    }

    }

    ?>

    :

    , "GET" :

    1. , "GET" "email" 2. , -

    .

    filter_input() .

    , "url" PHP :

    :

    , "POST" :

    1. , "POST" "url"

    2. , $url

    : "http://geocg.myweb.ge/", $url :

    http://geocg.myweb.ge/

  • . filter_var filter_input

    , filter_var_array, filter_input_array .

    filter_input_array() , GET

    . GET , - :

  • III

    PHP

    PHP MYSQL

    MYSQL?

    MySQL . .

    . HTML , , .

    , ,

    . : "", "", "" "".

    , . . .

    "Persons" :

    Hansen Ola Timoteivn 10 Sandnes

    Svendson Tove Borgvn 23 Sandnes

    Pettersen Kari Storgt 20 Stavanger

    (, ) (, , ).

  • , .

    MySQL- , .

    :

    SELECT LastName FROM Persons

    ,

    :

    Hansen

    Svendson

    Pettersen

    MYSQL -

    MYSQL

    ,

    .

    PHP-, mysql_connect() .

    :

    mysql_connect(servername,username,password);

    servername . "localhost:3306"

    username .

    password . .

    ($con)

    . "die" :

  • {

    die('Could not connect: ' . mysql_error());

    }

    // some code

    ?>

    , . the mysql_close() .

    MYSQL -

    CREATE DATABASE MySQL .

    CREATE DATABASE database_name

    PHP- ,

    mysql_query() . , MySQL

    .

    "my_db":

  • CREATE TABLE MySQL-

    .

    CREATE TABLE table_name

    (

    column_name1 data_type,

    column_name2 data_type,

    column_name3 data_type,

    .......

    )

    CREATE TABLE mysql_query() ,

    .

    "person", .

    "FirstName", "LastName" "Age":

    : .

    mysql_select_db() .

    : varchar ,

    , .: varchar(15).

    MYSQL

    MySQL :

  • int(size) smallint(size)

    tinyint(size) mediumint(size) bigint(size)

    .

    size

    decimal(size,d) double(size,d)

    float(size,d)

    .

    size .

    d

    char(size) .

    varchar(size) .

    tinytext , 255

    text

    blob , 65535

    mediumtext mediumblob

    , 16777215

    longtext longblob

    , 4294967295

    date(yyyy-mm -dd)

    datetime(yyyy-mm -dd hh:mm:ss) timestamp(yyyymmddhhmmss) time(hh:mm:ss)

    /

    Misc.

    enum(value1,value2,ect) ENUM ENUMERATED .

    65535 .

    , ,

    set SET ENUM-. , SET

    64 .

    MYSQL -

  • INSERT INTO

    .

    INSERT INTO table_name

    VALUES (value1, value2,....)

    , :

    INSERT INTO table_name (column1, column2,...)

    VALUES (value1, value2,....)

    : SQL , , .

    PHP- mysql_query()

    .

  • submit ,

    "insert.php" . "insert.php" , PHP $_POST . , mysql_query()

    INSERT INTO .

    "insert.php" :

  • :

    Peter Griffin

    Glenn Quagmire

    HTML

    HTML :

    :

    Firstname Lastname

    Glenn Quagmire

    Peter Griffin

    MYSQL -

    , ,

    WHERE clause, SELECT .

  • SELECT column FROM table

    WHERE column operator value

    WHERE clause- :

    =

    !=

    >

    <

    >=

  • SELECT column_name(s)

    FROM table_name

    ORDER BY column_name

    :

    Glenn Quagmire 33

    Peter Griffin 35

    ,

    ORDER BY-, .

    DESC :

    SELECT column_name(s)

    FROM table_name

    ORDER BY column_name DESC

    .

    , , :

    SELECT column_name(s)

    FROM table_name

    ORDER BY column_name1, column_name2

    MYSQL -

  • UPDATE

    .

    UPDATE table_name

    SET column_name = new_value

    WHERE column_name = some_value

    FirstName LastName Age

    Peter Griffin 35

    Glenn Quagmire 33

    "Person" :

  • FirstName LastName Age

    Peter Griffin 35

    Glenn Quagmire 33

    "Person" , LastName='Griffin':

  • IV

    PHP XML

    PHP XML EXPAT PARSER

    XML?

    XML . XML

    .

    XML-, . .

    EXPAT?

    - - XML , XML .

    XML :

    - : XML

    .

    . .: Document Object Model (DOM)

    - : XML ,

    . ,

    - .

    - XML

    .

    XML :

    Jani

    , - XML-, :

  • : from

    CDATA , : Jani : from

    XML well-formed XML-. ,

    XML-, (Document Type Definition (DTD)).

    XML PHP- .

    .

    XML

    XML :

    Tove

    Jani

    Reminder

    Don't forget me this weekend!

    XML

    XML PHP-,

    XML XML .

  • //Function to use at the end of an element

    function stop($parser,$element_name)

    {

    echo "";

    }

    //Function to use when finding character data

    function char($parser,$data)

    {

    echo $data;

    }

    //Specify element handler

    xml_set_element_handler($parser,"start","stop");

    //Specify data handler

    xml_set_character_data_handler($parser,"char");

    //Open XML file

    $fp=fopen("test.xml","r");

    //Read data

    while ($data=fread($fp,4096))

    {

    xml_parse($parser,$data,feof($fp)) or

    die (sprintf("XML Error: %s at line %d",

    xml_error_string(xml_get_error_code($parser)),

    xml_get_current_line_number($parser)));

    }

    //Free the XML parser

    xml_parser_free($parser);

    ?>

    :

    -- Note --

    To: Tove

    From: Jani

    Heading: Reminder

    Message: Don't forget me this weekend!

    :

    1. XML xml_parser_create()

    2. 3. xml_set_element_handler() , ,

    ,

    4. xml_set_character_data_handler() , ,

    ,

    .

    5. "test.xml" xml_parse() 6. , xml_error_string() XML

    7. xml_parser_free() , , xml_parser_create()

    PHP XML DOM

    DOM?

  • W3C DOM HTML XML

    .

    W3C DOM (Core, XML HTML)

    (DOM 1/2/3):

    Core DOM -

    XML DOM - XML

    HTML DOM - HTML

    DOM

    DOM - .

    XML :

    Jani

    XML DOM XML-, :

    1: XML

    2: : 3: : "Jani"

    XML

    XML :

    Tove

    Jani

    Reminder

    Don't forget me this weekend!

    XML-

    XML , xml- :

    load("note.xml");

    print $xmlDoc->saveXML();

    ?>

  • :

    Tove Jani Reminder Don't forget me this weekend!

    "View source" , HTML :

    Tove

    Jani

    Reminder

    Don't forget me this weekend!

    DOM - XML- "note.xml"-.

    saveXML() XML ,

    .

    XML

    XML , XML-

    :

    load("note.xml");

    $x = $xmlDoc->documentElement;

    foreach ($x->childNodes AS $item)

    {

    print $item->nodeName . " = " . $item->nodeValue . "";

    }

    ?>

    :

    #text =

    to = Tove

    #text =

    from = Jani

    #text =

    heading = Reminder

    #text =

    body = Don't forget me this weekend!

    #text =

    PHP SIMPLEXML

    SIMPLEXML?

    SimpleXML PHP 5-. , XML .

  • DOM, Expat parser- , SimpleXML , .

    SimpleXML XML , :

    - SimpleXMLElement

    . , ,

    - ,

    -

    .

    SimpleXML ,

    :

    XML

    XML

    ,

    SIMPLEXML-

    XML :

    Tove

    Jani

    Reminder

    Don't forget me this weekend!

    :

    1. XML

    2.

    3. , , children()

    4. getName() . "";

    foreach($xml->children() as $child)

    {

    echo $child->getName() . ": " . $child . "";

    }

    ?>

    : note

    to: Tove

    from: Jani

    heading: Reminder

    body: Don't forget me this weekend!