How does the data read from the database correspond to the defined constant?

Source: Internet
Author: User
How does the data read from the database correspond to defined constants? Consstant. php: define (town_9, Hengli); define (town_10, Qiaotou); define (town_11, Xie Gang); define (town_12, Dongkeng); define (town_13, Changping ); define (town_14, skip step); how does the data read from the database correspond to the defined constant?
Consstant. php:
Define ("town_9", "Hengli ");
Define ("town_10", "");
Define ("town_11", "Xie Gang ");
Define ("town_12", "Dongkeng ");
Define ("town_13", "Changping ");
Define ("town_14", "");
Define ("town_15", "dalang ");
Define ("town_16", "Huangjiang ");

Test. php:
... // Database operations
Echo $ row [0]; // $ row [0] the output is town_14
?>

In this way, running test. php shows that it is town_14, and the defined constant step is output. how is this good?
------ Solution --------------------

Define ("town_9", "Hengli ");
Define ("town_10", "");
Define ("town_11", "Xie Gang ");
Define ("town_12", "Dongkeng ");
Define ("town_13", "Changping ");
Define ("town_14", "");
Define ("town_15", "dalang ");
Define ("town_16", "Huangjiang ");

// Database operations
$ Row = array ();
$ Row [0] = "town_14 ";

$ Defined_constants = get_defined_constants ();
Echo $ defined_constants [$ row [0]; // skip step

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.