Play PHP numeric function _php Tutorial

Source: Internet
Author: User
PHP has a lot of places to learn, here we mainly introduce the PHP array function, let's start with a simple summary of the PHP bar. For ordinary computer enthusiasts, PHP may be a strange name. More concerned about the network of friends, especially those concerned about the site building technology friends, may have heard of PHP. PHP is a simple but powerful programming language designed to dynamically create HTML content.

PHP itself is a simple and powerful language. The PHP language has core features such as powerful string and array processing capabilities, while greatly improving the support for object-oriented programming (PHP5 and above). By using standard and optional extensions, PHP applications can connect more than 10 databases such as MySQL or Oracle, draw, create PDF files, and create parsing XML files. You can also use the C language to write your own PHP extension module. For example, provide an interface function for PHP in a code base that already exists. You can also run PHP under Windows, use COM to control other Windows applications such as Word and Excel, or use ODBC to connect to a database. For a brief introduction to PHP, let's look at the knowledge of PHP array functions.

1. Function key () that returns the keys of the current array value, returns false at the end

 
  
  1. $ a = Array ("Tom" =>"+", "jim" =>"$", "andy" =>" ");
  2. Configure the key function to cycle through the key of $ A and assign a value of $key until the read is complete
  3. While ($keykey=key ($a)) {
  4. Echo $key;
  5. Next is responsible for moving the array pointer to the next
  6. Next ($a);

2. Gets the current pointer to the PHP value function, and returns false at the end

 
  
  1. $ a = Array ("Tom" =>"+", "jim" =>"$", "andy" =>" ");
  2. Configure the key function to loop through the array value of $ A and assign a value of $key until the read is complete
  3. While ($key=current($a)) {
  4. Echo $key;
  5. Next ($a);

3. The merged version of each of the above two cases returns an array, which can be read by using the list.

And you can omit next, because he jumps automatically.

 
  
  1. $ a = Array ("Tom" =>"+", "jim" =>"$", "andy" =>" ");
  2. Configure a loop to read a $ A array value with a key and assign values separately until the read is complete
  3. while (list ($key, $val) =each ($a)) {
  4. Echo $key, $val, " <br> ";

4. In particular, the function of moving pointers

(1) Next statement, as the name implies, moves to the next meaning

 
  
  1. $ a = Array ("Tom", "Jim", "Andy");
  2. Echo next ($a);//output Jim

(2) A prev statement that moves the pointer forward. Ditto, not an example.

(3) Reset statement, back to the first position, ditto also not for example

(4) End statement, to the last one, not an example!!


http://www.bkjia.com/PHPjc/446523.html www.bkjia.com true http://www.bkjia.com/PHPjc/446523.html techarticle PHP has a lot of places to learn, here we mainly introduce the PHP array function, let's start with a simple summary of the PHP bar. For ordinary computer enthusiasts, PHP may be a strange ...

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