Question

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' ),
        )
    )
);
Was it helpful?

Solution

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' ),
        )
    )
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top