-1

Can i do this in PHP, or any others way around ? I want to refer to another element in the array.

$config = array(
    'factory-code'  => array(
        '01', '02'
    ),
    'commodity-filter'  => array(
        'factory' => array(
            'steel'     => array( $this->factory-code ),
        ),
        'branch' => array(
            'steel'     => array( $this->factory-code, '09' ),
        )
    )
);
Azri Jamil
  • 2,394
  • 2
  • 29
  • 37
  • You can't create references to the same array, you could set it after the fact. I don't know why you would do this when you have the info you need in the array already. – Korvin Szanto Sep 16 '12 at 13:59

1 Answers1

0

You'll have to create the factory-code in a separate array

$factory_code  => array('01', '02');

$config = array(
    'factory-code'  => $factory_code,
    'commodity-filter'  => array(
        'factory' => array(
            'steel'     => array( $factory_code ),
        ),
        'branch' => array(
            'steel'     => array( $factory_code, '09' ),
        )
    )
);
Wasim
  • 4,953
  • 10
  • 52
  • 87