$line [1] = Intval ($line [1]); What does this mean by writing this?

Source: Internet
Author: User
   <title>Bob ' s Auto parts-customer Orders</title>

Bob ' s Auto Parts

Customer Orders

No orders pending. Please try again later.

"; } echo " \ n "; echo " Oil Total "; for ($i =0; $i < $number _of_orders; $i + +) {//split up all line $line = explode ("\ t", $orders [$i]); Keep only the number of items ordered $line [1] = Intval ($line [1]); $line [2] = Intval ($line [2]); $line [3] = Intval ($line [3]); Output each order echo " "; } echo "
Order Date Tires Spark Plugs Address
". $line [0]." ". $line [1]." ". $line [2]." ". $line [3]." ". $line [4]." ". $line [5]."
";? >


$line [1] = Intval ($line [1]); What does this mean by writing this? The Intval manual is the integer value that describes intval returns the variable var by using a specific binary conversion (by default, decimal). But what is the effect of assigning this integer value to $line[1]?


Reply to discussion (solution)

The intval () variable turns into an integer type $line[1] = Intval ($line [1]); $line [2] = Intval ($line [2]), $line [3] = Intval ($line [3]), and a variable that converts to an integer type to regroup an array $line you can also reassign the variable $line_a = intval ($line [1] ); $line _b = Intval ($line [2]), $line _c = Intval ($line [3]); Then your template shows that the corresponding needs change.

$line [1] = Intval ($line [1]);
Ensures that the value of the final $line [1] is an integer

Besides, the original author has already made a statement
38 lines have keep only the number of items ordered

  • 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.