PHP numeric function _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
PHP numeric functions. PHP has a lot to learn about. here we mainly introduce PHP array functions. let's briefly summarize PHP. For general computer enthusiasts, PHP may be a stranger to PHP. There are many things worth learning. here we will mainly introduce PHP array functions. let's briefly summarize PHP. For general computer enthusiasts, PHP may be a strange name. Those who are more interested in the Internet, especially those who are interested in website construction technology, 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. PHP has core features such as powerful string and array processing capabilities, and greatly improved support for object-oriented programming (PHP5 and later versions ). Using standard and optional extension modules, PHP applications can connect to more than a dozen databases such as MySQL or Oracle, draw, create PDF files, and create parsed XML files. You can also use the C language to write your own PHP extension module. For example, provide a PHP interface function in an existing code library. You can also run PHP in Windows, use COM to control other Windows applications such as Word and Excel, or use ODBC to connect to the database. The above is a brief introduction to PHP. let's take a look at the knowledge of PHP array functions.

1. return the function key () of the key of the current array value, and return false at the end.

 
  1. $A=Array("Tom" =>"21", "jim" =>"22", "andy" =>"25 ");
  2. // Configure the key function to read the $ a key cyclically and assign a value to $ key until the read is complete.
  3. While ($KeyKey= Key ($ )){
  4. Echo $ key;
  5. // Next is responsible for moving the array pointer to the next
  6. Next ($ );
  7. }

2. get the PHP numeric function current of the current pointer, and return false at the end.

 
  1. $A=Array("Tom" =>"21", "jim" =>"22", "andy" =>"25 ");
  2. // Configure the key function to read the array value of $ a cyclically and assign a value to $ key until the read is complete.
  3. While ($Key=Current($ )){
  4. Echo $ key;
  5. Next ($ );
  6. }

3. the combined version of each () in the preceding two examples returns an array, which can be read using list.

Next can be omitted because it automatically jumps.

 
  1. $A=Array("Tom" =>"21", "jim" =>"22", "andy" =>"25 ");
  2. // Configure to read the array values and keys of $ a cyclically and assign values to them until the read is complete.
  3. While (list ($ key, $ val) = each ($ )){
  4. Echo $ key, $ val ,"<Br>";
  5. }

4. Note that the function of moving the pointer

(1) next statement, as the name implies, to the next

 
  1. $A=Array("Tom", "jim", "andy ");
  2. Echo next ($ a); // output jim
  3. Echo next ($ a); // output andy

(2) prev statement: a forward pointer statement. The preceding example is not used.

(3) The reset statement is returned to the first position.

(4) The end statement, to the last one, is not an example !!


Bytes. For general computer enthusiasts, PHP may be a stranger...

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.