PHP Heredoc Original document and Nowdoc syntax

Source: Internet
Author: User
    
 
  
     <title>Current To-do List</title>
 '; foreach ($parent as $task _id = $todo) {echo <<
 
  • $todoEOT; if (Isset ($tasks [$task _id])) {//If the current ID has subtasks, the menu make_list is created recursively ($tasks [$task _id]); } echo ""; } Echo ''; } $db = Mysqli_connect (' 192.168.31.172 ', ' root ', ' root ', ' phpadvanced '); Mysqli_query ($db, "Set names UTF8"); if (($_server[' request_method ' = = ' POST ') && isset ($_post[' tasks ') && Is_array ($_post[' tasks ') &&!empty ($_post[' tasks ')) {$q = ' UPDATE tasks SET date_completed=now () WHERE task_id in ('; foreach ($_post[' tasks ') as $task _id = $v) {$q. = $task _id. ', '; } $q = substr ($q, 0,-2). ')'; $r = Mysqli_query ($db, $q); if (mysqli_affected_rows ($db) = = Count ($_post[' tasks ')) {echo '

    The selected task is already marked complete

    '; } else {echo '

    The selected task cannot be marked as complete

    '; }} $q = ' SELECT task_id, parent_id, task from Tasks WHERE date_completed= ' 0000-00-00 00:00:00 ' ORDER by parent_id, date_added ASC '; $r = Mysqli_query ($db, $q); $tasks = Array (), while (list ($task _id, $parent _id, $task) = Mysqli_fetch_array ($r, Mysqli_num)) {$tasks [$parent _id][$t ASK_ID] = $task;} Echo '
    '. Print_r ($tasks, 1). '
    ';//This is the original document, Heredoc format echo <<

    <>

    Click the check box to mark the completion. (the task itself is already all subtasks will not appear in this list)

    EOT;? >

  • The above describes the PHP heredoc original document and Nowdoc syntax, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.