About PHP two-dimensional array assignment detailed introduction _php tutorial

Source: Internet
Author: User
Tags php language
PHP has a lot of places to learn, here we mainly introduce PHP two-dimensional array assignment, let's start with a brief summary of PHP. 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's two-dimensional array assignment.

In the ASP

 
  
  

The number of records in the SQL statement query is total.

 
  
  

Assigning values through a while loop

 
  
  
  1. Namare (i,1) =rolename

But how do you implement PHP two-dimensional array assignment? In PHP, I define a two-dimensional array:

 
  
  
  1. $ Data_array =array ($total, 2);//The number of records where $datarows is the query

The specific loops are as follows: SQL statements ....

 
  
  
  1. $ I = 0 ;
  2. While ($result= $db->fetch_array ($query))
  3. {
  4. $ Area = $result ["area"];
  5. $data _array[$i][2]= $Area; Error!
  6. $ I = $i +1;
  7. }

http://www.bkjia.com/PHPjc/446520.html www.bkjia.com true http://www.bkjia.com/PHPjc/446520.html techarticle PHP has a lot of places to learn, here we mainly introduce PHP two-dimensional array assignment, let's start with a brief summary of PHP. For ordinary computer enthusiasts, PHP may be a ...

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