Array questions for help

Source: Internet
Author: User
Php for array problems



The return array () array exists in a single configuration room. how can I reference the value of the first element in the value of the second element?


Reply to discussion (solution)

The purpose is to associate 'A' and 'B? If you want to add another variable, trigger the trigger.

 

$ A = array ('a' => 1, 'B' => & $ a ['A'], 'C' => 3 ); // This write method is not feasible because it is not executed and $ a ['A'] does not exist.
$ A ['B'] = & $ a ['A ']; //

You can understand the effect of this code

$a = array('a' => 3);$a = array('a' => 1, 'b' => &$a['a'], 'c' => 3);//$a['b'] = &$a['a'];print_r($a);echo $a['b'];

You can understand the effect of this code

$a = array('a' => 3);$a = array('a' => 1, 'b' => &$a['a'], 'c' => 3);//$a['b'] = &$a['a'];print_r($a);echo $a['b'];

I am in a php configuration file, and the entire file is return array (). Operations can only be performed in array.

The requirement itself is meaningless: does one member reference another?

The requirement itself is meaningless: does one member reference another?
Maybe I didn't design it.

Then I have such a code file:
Return array (
'Domain '=> 'http: // www.xxx.com /',
'Js' => 'http: // www.xxx.com/js ',
'IMG '=> 'http: // www.xxx.com/img ',
'Css '=> 'http: // www.xxx.com/css'
);
?>
Can I repeat http://www.xxx.com/to replace it with a constant variable?

Why are the values of the four elements different?
Don't want http://www.xxx.com/just don't write
Http://www.xxx.com/is your website, not someone else's. You do not need to write

Why are the values of the four elements different?
Don't want http://www.xxx.com/just don't write
Http://www.xxx.com/is your website, not someone else's. You do not need to write

Some of the four values are repeated.

Of course, this is an example, not necessarily a domain name.

Haven't you understood the nature of the question I want to ask yet?

Of course I know what you mean!
I also told you why this cannot be done.

1. either declare a temporary variable before return
2. either process after return, that is, return array does not contain element B. Then, if no element B is determined by the logic, the value of Element B is equal to the value of element.

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.